:root {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --primary-blue: #2962ff;
  --accent-blue: #448aff;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --border-color: transparent;
  --base-font-size: 16px;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-color: #f1f5f9;
  --text-muted: #94a3b8;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: var(--base-font-size);
  transition: background-color 0.3s, color 0.3s, font-size 0.3s;
}

/* Header */
header {
  background-color: var(--primary-blue);
  color: white;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding-bottom: 4rem;
  /* Light text on a saturated background picks up coloured fringing from
     subpixel antialiasing on macOS, which reads as blurry. Grayscale
     antialiasing renders these edges clean. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Angled bottom edge. Drawn as an overlay rather than clipping the header
   itself — clipping puts the header on its own layer and softens the text. */
header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5rem;
  background-color: var(--bg-color);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  pointer-events: none;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fira Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

#logo-canvas {
  width: 72px;
  height: 72px;
  margin: -12px 0;
  display: inline-block;
  vertical-align: middle;
}

/* Header links */
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  position: relative;
  z-index: 10;
}
.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}
.btn-white {
  background: white;
  color: var(--primary-blue) !important;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Toggles */
.toggles {
  display: flex;
  gap: 0.5rem;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  transition: opacity 0.5s ease-in-out;
}
.toggles.hidden {
  opacity: 0;
  pointer-events: none;
}
.toggles button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}
.toggles button:hover {
  background: rgba(255,255,255,0.4);
}

/* Layout */
.container {
  max-width: 800px;
  margin: -2rem auto 2rem;
  padding: 0 1rem;
  position: relative;
  z-index: 10;
}

/* Cards (Flat, minimalist, only 2 colors at edge) */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: background-color 0.3s;
  border: none; /* No messy borders */
}

/* Buttons */
.btn-primary {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  width: 100%;
  transition: background-color 0.2s;
}
.btn-primary:hover {
  background-color: var(--primary-blue);
}

/* Carousel */
.carousel {
  width: 100%;
  height: 350px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* Promo Banner */
.promo-banner {
  background: var(--primary-blue);
  color: white;
  text-align: center;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* Forms */
input, textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
  font-family: inherit;
}

/* Review layout */
.review-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-color);
  object-fit: cover;
}
.review-meta {
  display: flex;
  flex-direction: column;
}
.review-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}
/* Rating line beside the "Reviews" heading */
.rating-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fira Sans', system-ui, -apple-system, sans-serif;
  /* Digits share a fixed width so the number doesn't jitter as it updates */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

#rating-average {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.rating-stars {
  font-size: 0.95rem;
  letter-spacing: 1px;
  line-height: 1;
}

.rating-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  line-height: 1;
}

.stars {
  display: flex;
  gap: 2px;
}
.stars svg {
  width: 1.1em;
  height: 1.1em;
  fill: #c5a059; /* Modern flat bronze/gold */
}
.nextdoor-label {
  color: #16a34a;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 5rem;
  }
  .nav-links {
    flex-wrap: wrap;
  }
}
