/* Public Denver areas — mirrors NeighborhoodCard + AreaProfilePanel (no drag). */

:root {
  --bg: #faf8f6;
  --surface: #fffcfa;
  --surface-raised: #ffffff;
  --text: #2a211c;
  --muted: #5f5046;
  --faint: #6d5f54;
  --accent-editorial: #bf0a30;
  --accent-editorial-hover: #a30928;
  --accent-editorial-deep: #8a0722;
  --accent-mint-ink: #002868;
  --on-accent: #ffffff;
  --theme-accent: var(--accent-editorial);
  --line: #ebe5df;
  --line-strong: #ddd5cc;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --card-max: 36rem;
  --prose-max: 36rem;
  --page-pad-x: 1.25rem;
  --nav-below-gap: 0.85rem;
  --radius-xs: 10px;
  --shadow-sm: 0 2px 10px rgb(191 10 48 / 7%), 0 1px 3px rgb(42 33 28 / 5%);
  --shadow-md: 0 10px 28px rgb(71 184 232 / 12%), 0 4px 10px rgb(42 33 28 / 7%);
  --sans: 'Outfit', Helvetica, Arial, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --brand: 'Shrikhand', Georgia, serif;
  /* Match BrandLockup / landing — soft pink fill + dark stroke */
  --brand-den: #e05570;
  --brand-den-stroke: #2a211c;
  --bounce-ease: cubic-bezier(0.34, 1.3, 0.64, 1);
  --mobile-map-inset: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--sans);
}

.page {
  width: 100%;
  min-height: 100%;
  padding:
    max(1.5rem, env(safe-area-inset-top, 0px))
    max(var(--page-pad-x), env(safe-area-inset-right, 0px))
    max(2.5rem, env(safe-area-inset-bottom, 0px))
    max(var(--page-pad-x), env(safe-area-inset-left, 0px));
}

.page--detail {
  /* Nav bar owns top safe-area; content pad starts below sticky bar gap. */
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

.page-inner {
  width: min(100%, var(--card-max));
  margin-inline: auto;
}

.page--detail .detail-inner {
  padding:
    var(--nav-below-gap)
    max(var(--page-pad-x), env(safe-area-inset-right, 0px))
    max(2.5rem, env(safe-area-inset-bottom, 0px))
    max(var(--page-pad-x), env(safe-area-inset-left, 0px));
}

/* —— AppNavBar mirror —— */

.nav-bar {
  position: sticky;
  top: var(--mobile-map-inset);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: 2.875rem;
  padding: calc(0.35rem + env(safe-area-inset-top, 0px)) var(--page-pad-x) 0.35rem;
  margin-bottom: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.35rem 0.5rem 0.35rem 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-back:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-back span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-back:active {
  opacity: 0.55;
}

.nav-back svg {
  flex-shrink: 0;
  display: block;
}

.brand-title {
  margin: 0 0 1.5rem;
  min-width: 0;
  flex: 0 1 auto;
  /* Match BrandLockup (app chrome) */
  font-size: 3rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.45;
  color: var(--text);
  text-align: start;
}

.brand-title-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.brand-title-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: 4px;
}

.brand-move {
  display: block;
  font-family: var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0;
  padding-left: 0.04em;
  font-size: 0.4em;
  font-style: italic;
  font-weight: 600;
  line-height: revert-layer;
  translate: 0.3em;
}

.brand-den {
  display: block;
  font-family: var(--brand);
  font-style: normal;
  font-weight: 400;
  line-height: 0.88;
  color: var(--brand-den);
  letter-spacing: 0.01em;
  -webkit-text-stroke: 0.028em var(--brand-den-stroke, #2a211c);
  paint-order: stroke fill;
}

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-editorial);
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-lede {
  margin: 0.85rem 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--muted);
}

/* —— Detail hero (DetailView) —— */

.page-header--prose {
  max-width: var(--prose-max);
  margin-bottom: 0;
  padding-bottom: 0.25rem;
}

.detail-hero {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.detail-city {
  margin: 0;
  min-width: 0;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--theme-accent);
}

.detail-title {
  margin: 0;
  min-width: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: var(--prose-max);
  margin-top: 1.75rem;
  min-width: 0;
}

.detail-map {
  margin: 1.1rem 0 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--faint) 10%, var(--line));
  aspect-ratio: 16 / 9;
}

.detail-map img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* —— List of cards (NeighborhoodRankList / NeighborhoodCard) —— */

.list-stage {
  margin-top: 1.5rem;
}

.rank-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.listing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--card-max);
  min-width: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: inherit;
  transition:
    transform 0.22s var(--bounce-ease),
    border-color 0.18s ease,
    background 0.18s ease;
}

.listing-card:active {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--theme-accent) 5%, var(--surface-raised));
  transform: scale(0.992);
}

.listing-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  background: none;
}

.listing-body:hover {
  color: inherit;
  text-decoration: none;
}

.listing-body:not(.has-photo):not(.has-spark) {
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem 0.75rem;
}

.listing-photo {
  position: relative;
  flex: 0 0 5rem;
  width: 5rem;
  min-height: 4.75rem;
  align-self: stretch;
  overflow: hidden;
  border-radius: calc(var(--radius-sm) - 2px) 0 0 calc(var(--radius-sm) - 2px);
  background: color-mix(in srgb, var(--faint) 10%, var(--line));
}

.listing-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.listing-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
  padding: 0.7rem 0.9rem 0.75rem;
}

.listing-body.has-spark:not(.has-photo) .listing-main {
  padding-left: 0.9rem;
}

.listing-body:not(.has-photo):not(.has-spark) .listing-main {
  padding: 0;
}

.listing-title {
  margin: 0;
  min-width: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-meters {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.2rem 0.45rem;
  width: 100%;
  max-width: 15rem;
  min-width: 0;
}

.card-meter {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  min-width: 0;
  max-width: 2.35rem;
}

.card-meter-label {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
}

.card-meter-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.08rem;
  width: 100%;
  max-width: 1.55rem;
  height: 0.28rem;
}

.card-meter-step {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: color-mix(in srgb, var(--line) 85%, var(--bg));
}

.card-meter-step.on {
  background: var(--accent-editorial);
}

.listing-spark {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  align-self: stretch;
  padding: 0.55rem 0.85rem 0.55rem 0;
}

.spark {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  min-width: 0;
}

.spark .chart {
  display: block;
  width: 4.5rem;
  height: 1.75rem;
}

.spark .line {
  stroke: var(--theme-accent);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  fill: none;
}

.spark .price {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
}

/* —— AreaProfilePanel + AreaMarketPanel —— */

.block {
  margin: 0;
}

.section-title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.summary {
  margin: 0;
  font-size: 0.975rem;
  line-height: 1.45;
  color: var(--text);
}

.viz {
  display: grid;
  gap: 0.55rem;
}

.viz-after {
  margin-top: 0.9rem;
}

.meter {
  display: grid;
  grid-template-columns: 2.75rem 3.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem 0.65rem;
}

.meter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.meter-bucket {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.meter-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.12rem;
  height: 0.4rem;
}

.meter-step {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: color-mix(in srgb, var(--line) 85%, var(--bg));
}

.meter-step.on {
  background: var(--accent-editorial);
}

.zip {
  margin: -0.35rem 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
}

.stats {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
}

.stat dt {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.stat dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--text);
  text-align: right;
}

.updated {
  margin: 0.9rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
}

.updated.stale {
  color: var(--theme-accent);
  font-weight: 650;
}

.sources {
  margin: 0.85rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--muted);
}

.market-block .sources {
  margin-top: 0.45rem;
}

/* —— AreaSaleListingsPanel (static) —— */

.sale-listing-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sale-listings .listing-body {
  flex-direction: column;
  justify-content: center;
  padding: 0.65rem 0.85rem 0.7rem;
}

.sale-listings .listing-body.has-photo {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
}

.sale-listings .listing-main {
  gap: 0.2rem;
  padding: 0;
}

.sale-listings .listing-body.has-photo .listing-main {
  padding: 0.65rem 0.85rem 0.7rem;
}

.sale-listings .listing-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.sale-listings .listing-title {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.sale-listings .card-price {
  margin: 0;
  flex-shrink: 0;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--accent-mint-ink);
  font-feature-settings: 'tnum' 1;
  font-variant-numeric: tabular-nums;
}

.sale-listings .listing-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-top: 0.15rem;
}

.sale-listings .card-facts,
.sale-listings .card-listed {
  margin: 0;
  min-width: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--muted);
  font-feature-settings: 'tnum' 1;
  font-variant-numeric: tabular-nums;
}

.sale-listings .card-listed {
  flex-shrink: 0;
}

.sale-listings .sources {
  margin-top: 0.45rem;
}

/* MarketTrendChart (static) */
.market-chart-wrap {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.market-chart-caption {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--muted);
}

.market-chart-frame {
  position: relative;
}

.market-chart {
  display: block;
  width: 100%;
  height: auto;
}

.market-chart .line {
  stroke: var(--theme-accent);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.market-chart .end-dot {
  fill: var(--theme-accent);
  stroke: var(--bg);
  stroke-width: 1.5;
}

.market-chart-frame .end {
  position: absolute;
  z-index: 1;
  display: grid;
  gap: 0.1rem;
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  pointer-events: none;
}

.market-chart-frame .end-value {
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text);
}

.market-chart-frame .end-month {
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}

/* —— CTA + footer —— */

.cta {
  margin: 2rem 0 0;
  padding: 1.35rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.cta-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cta-copy {
  margin: 0.55rem 0 0;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.1rem;
  padding: 0.7rem 1.4rem;
  padding-block-end: 0.875rem;
  border: 2px solid var(--accent-editorial);
  border-radius: var(--radius-pill);
  background: var(--accent-editorial);
  color: var(--on-accent);
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.22s var(--bounce-ease),
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.22s var(--bounce-ease),
    color 0.18s ease;
}

.btn:hover {
  background: var(--accent-editorial-hover);
  border-color: var(--accent-editorial-deep);
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.note {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--faint);
}

.footer {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--faint);
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent-editorial);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
