: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;
}

/* Line-art mark, drawn as SVG so it stays sharp at any size */
#logo-mark {
  width: 46px;
  height: 46px;
  display: inline-block;
  vertical-align: middle;
  color: #ffffff;
  /* Perspective makes the turn read as an object rotating in space rather
     than a flat shape being squashed horizontally */
  perspective: 260px;
}

#logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  transform-style: preserve-3d;
  animation: logo-orbit 26s linear infinite;
}

@keyframes logo-orbit {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #logo-mark svg { animation: none; }
}

/* 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-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}
.carousel {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;      /* square frame */
  border-radius: 12px;
  object-fit: cover;        /* fill the square, crop slightly for a clean edge */
  object-position: center;
  background: var(--card-bg);
  box-shadow: 0 4px 12px var(--shadow-color);
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.carousel-arrow:hover { background: #fff; }
.carousel-arrow:active { transform: translateY(-50%) scale(0.92); }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }
.carousel-arrow span { pointer-events: none; }

/* Pause/play — sits directly under the right arrow, always visible. */
.carousel-pause {
  position: absolute;
  top: calc(50% + 34px);   /* just below the arrow */
  right: 19px;             /* centered under the right arrow (right:12px, 44px wide) */
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  font-size: 0.75rem;
  letter-spacing: 1px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s;
}
.carousel-pause:hover { background: #fff; }

/* 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: 1.15rem;
  font-weight: 700;
  color: #16a34a;
  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;
  }
}

/* Search-match highlight — soft tinted pill, not the harsh default yellow. */
mark.hl {
  background: rgba(250, 204, 21, 0.85);   /* warm amber, easy to spot */
  color: #1e293b;                         /* dark text stays readable on amber */
  font-weight: 700;
  padding: 0.05em 0.3em;
  border-radius: 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Owner reply — expandable dropdown, like Nextdoor's business reply */
.owner-reply {
  margin-top: .85rem;
  border-left: 3px solid var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 6%, transparent);
  border-radius: 0 8px 8px 0;
}
.owner-reply summary {
  list-style: none;
  cursor: pointer;
  padding: .55rem .8rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  user-select: none;
}
.owner-reply summary::-webkit-details-marker { display: none; }
.or-badge { font-weight: 700; font-size: .85rem; color: var(--accent-blue); }
.or-caret { color: var(--accent-blue); transition: transform .15s; font-size: 1.1rem; line-height: 1; }
.owner-reply[open] .or-caret { transform: rotate(90deg); }
.or-body { padding: 0 .8rem .8rem; display: flex; flex-wrap: wrap; gap: .6rem; }
.or-body p { margin: 0; line-height: 1.5; color: var(--text-color); }
.or-photo {
  width: 150px; height: 150px;
  object-fit: cover;
  border-radius: 10px;
}
