/* Finding homes: the store-like search (shared by a person's workspace, a
   brokerage's site and the agent's Homes), and the marketplace frame around
   it. Design-system tokens only (docs/DESIGN-SYSTEM.md): no raw colors, sizes
   on the 4px grid, radii from the scale, .btn for actions, kit badges. */

.re__inline { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.re__error { color: var(--crit); margin: 0; }
.re__note { color: var(--text-2); font-size: var(--fs-2); margin: 0; }

/* ---- The marketplace frame ------------------------------------------- */
.mkt { min-height: 100vh; background: var(--surface-0); color: var(--text-1); font-family: var(--text); font-size: var(--fs-3); }
.mkt__top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-6); align-items: center; padding: var(--sp-4) var(--gutter); background: var(--surface-1); border-bottom: 1px solid var(--border-1); }
.mkt__logo img { height: 36px; display: block; }
.mkt__brand { font-family: var(--display); font-weight: 800; font-size: var(--fs-6); color: var(--text-1); }
.mkt__logo { text-decoration: none; }
.mkt__search { display: flex; max-width: 44rem; width: 100%; justify-self: center; }
.mkt__search input { flex: 1; min-width: 0; height: 40px; padding: 0 var(--sp-3); border: 1px solid var(--border-2); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: var(--surface-1); color: var(--text-1); font: inherit; font-size: var(--fs-4); }
.mkt__go { height: 40px; padding: 0 var(--sp-5); border: 1px solid var(--accent); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--accent); color: var(--text-on-accent); font: inherit; font-weight: 600; font-size: var(--fs-4); cursor: pointer; }
.mkt__go:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.mkt__right { display: flex; gap: var(--sp-3); align-items: center; }
.mkt__cart { display: inline-flex; align-items: center; gap: var(--sp-2); background: none; border: 0; color: var(--text-1); font: inherit; font-size: var(--fs-4); font-weight: 500; cursor: pointer; padding: var(--sp-2); border-radius: var(--r-md); }
.mkt__cart:hover { background: var(--surface-2); }
.mkt__count:not(:empty) { min-width: 20px; height: 20px; padding: 0 var(--sp-1); border-radius: var(--r-pill); background: var(--accent); color: var(--text-on-accent); font-size: var(--fs-1); font-weight: 700; display: inline-grid; place-items: center; }
.mkt__said:empty { display: none; }
.mkt__said { margin: 0; padding: var(--sp-2) var(--gutter); background: var(--warn-soft); color: var(--warn); }
.mkt__nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: 0 var(--gutter); min-height: 52px; background: var(--brand-ink); }
.mkt__links { display: flex; gap: var(--sp-1); overflow-x: auto; }
.mkt__link { background: none; border: 0; border-bottom: 2px solid transparent; padding: var(--sp-3) var(--sp-3); color: var(--surface-1); opacity: 0.85; font: inherit; font-size: var(--fs-4); text-decoration: none; white-space: nowrap; cursor: pointer; }
.mkt__link:hover, .mkt__link--on { opacity: 1; border-bottom-color: var(--surface-1); }
.mkt__cta { flex: none; height: var(--ctl); padding: 0 var(--sp-4); border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--text-on-accent); font: inherit; font-weight: 600; font-size: var(--fs-4); cursor: pointer; }
.mkt__cta:hover { background: var(--accent-strong); }
.mkt__content { max-width: 96rem; margin: 0 auto; padding: var(--sp-6) var(--gutter) var(--sp-10); display: grid; gap: var(--sp-5); }
.mkt :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- The search page --------------------------------------------------- */
.shop__top { display: flex; align-items: center; gap: var(--sp-3); }
.shop__layout { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.shop__results { display: grid; gap: var(--sp-4); align-content: start; min-width: 0; }
.shop__heading h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: var(--fs-7); color: var(--text-1); }
.shop__heading p { margin: var(--sp-1) 0 0; color: var(--text-2); font-size: var(--fs-4); }
.shop__heading strong { color: var(--text-1); }

/* Filters: panels down the side; a drawer on a phone. */
.shop__filters { position: sticky; top: var(--sp-4); display: grid; border: 1px solid var(--border-2); border-radius: var(--r-xl); background: var(--surface-1); overflow: hidden; }
.shop__drawerhead { display: none; }
.shop__panel { border-bottom: 1px solid var(--border-1); }
.shop__panel summary { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) var(--sp-4); font-family: var(--display); font-weight: 700; font-size: var(--fs-4); cursor: pointer; list-style: none; }
.shop__panel summary::-webkit-details-marker { display: none; }
.shop__panel summary::after { content: '⌃'; color: var(--text-3); }
.shop__panel:not([open]) summary::after { content: '⌄'; }
.shop__panelbody { display: grid; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-4); }
.shop__filters input:not([type=checkbox]), .shop__filters select { width: 100%; box-sizing: border-box; height: var(--ctl); padding: 0 var(--sp-2); border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface-1); color: var(--text-1); font: inherit; }
.shop__filters, .shop__panel, .shop__panelbody, .shop__two > * { min-width: 0; }
.shop__two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.shop__mini { display: grid; gap: var(--sp-1); color: var(--text-2); font-size: var(--fs-2); }
.shop__label { color: var(--text-2); font-size: var(--fs-2); }
.shop__quick { display: grid; gap: var(--sp-1); }
.shop__qlink { background: none; border: 0; padding: 0; text-align: left; color: var(--accent); font: inherit; cursor: pointer; }
.shop__qlink:hover { text-decoration: underline; }
.shop__check { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-start; text-align: left; }
.shop__check input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }
.shop__check small { color: var(--text-3); }
.shop__pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.shop__pill { height: var(--ctl); border: 1px solid var(--border-2); background: var(--surface-1); color: var(--text-1); border-radius: var(--r-md); font: inherit; font-size: var(--fs-2); cursor: pointer; white-space: nowrap; }
.shop__pill--on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.shop__filteractions { display: grid; gap: var(--sp-2); padding: var(--sp-4); }
.shop__filteractions .btn { width: 100%; justify-content: center; }
.shop__scrim { display: none; }

/* The row of filter chips (phones). */
.shop__chiprow { display: none; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-1); }
.shop__fchip { flex: none; height: var(--ctl); padding: 0 var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface-1); color: var(--text-1); font: inherit; white-space: nowrap; cursor: pointer; }
.shop__fchip--on { border-color: var(--text-1); font-weight: 600; }

.shop__bar { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.shop__sort { display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--ctl); padding: 0 var(--sp-2) 0 var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface-1); color: var(--text-2); }
.shop__sort select { border: 0; background: none; color: var(--text-1); font: inherit; width: auto; }
.shop__bar .btn { margin-left: auto; }

/* Totals over the results (the kit's stat look). */
.shop__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--sp-3); }
.shop__stat { border: 1px solid var(--border-1); border-radius: var(--r-xl); padding: var(--sp-3) var(--sp-4); display: grid; gap: var(--sp-1); background: var(--surface-1); }
.shop__stat small { color: var(--text-2); font-size: var(--fs-2); }
.shop__stat strong { font-family: var(--display); font-size: var(--fs-5); font-variant-numeric: tabular-nums; }

/* Home cards. */
.shop__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--sp-5); }
.shop__card { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--border-1); border-radius: var(--r-xl); overflow: hidden; background: var(--surface-1); box-shadow: var(--shadow-1); }
.shop__media { position: relative; }
.shop__open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.shop__ph { aspect-ratio: 16 / 10; display: grid; place-content: center; justify-items: center; gap: var(--sp-1); color: var(--text-3); background: var(--surface-2); }
.shop__ph span { font-weight: 600; color: var(--text-2); }
.shop__ph small { font-size: var(--fs-1); }
.shop__ph--photo { position: relative; padding: 0; overflow: hidden; }
.shop__ph--photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shop__ph--big { aspect-ratio: 16 / 8; border-radius: var(--r-xl); }
.shop__badge { position: absolute; top: var(--sp-3); left: var(--sp-3); }
.shop__badge .kbadge { background: var(--surface-1); text-transform: uppercase; letter-spacing: 0.02em; box-shadow: var(--shadow-1); }
.shop__heart { position: absolute; top: var(--sp-2); right: var(--sp-2); width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-pill); border: 0; background: var(--surface-1); color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-1); }
.shop__heart:hover { color: var(--text-1); }
.shop__heart--on { color: var(--accent); }
.shop__homeicon { position: absolute; left: var(--sp-3); bottom: var(--sp-3); width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--surface-1); color: var(--text-2); pointer-events: none; }
.shop__dots { position: absolute; left: 50%; bottom: var(--sp-3); transform: translateX(-50%); display: flex; gap: var(--sp-1); pointer-events: none; }
.shop__dots span { width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--surface-1); opacity: 0.55; }
.shop__dots span.on { opacity: 1; }
.shop__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--surface-1); color: var(--text-1); font-size: var(--fs-5); cursor: pointer; opacity: 0; box-shadow: var(--shadow-1); }
.shop__nav--prev { left: var(--sp-2); }
.shop__nav--next { right: var(--sp-2); }
.shop__media:hover .shop__nav, .shop__nav:focus-visible { opacity: 1; }
.shop__credit { position: absolute; left: var(--sp-2); bottom: var(--sp-2); background: var(--surface-1); color: var(--text-2); border-radius: var(--r-sm); padding: 0 var(--sp-1); font-size: var(--fs-1); }
.shop__body { display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4) var(--sp-4); align-content: start; }
.shop__textlink { display: grid; gap: 2px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.shop__textlink:hover .shop__addr { text-decoration: underline; }
.shop__price { font-family: var(--display); font-weight: 800; font-size: var(--fs-7); line-height: 1.15; font-variant-numeric: tabular-nums; }
.shop__price--big { font-size: var(--fs-7); }
.shop__line { color: var(--text-1); font-size: var(--fs-4); }
.shop__addr { color: var(--text-2); font-size: var(--fs-4); overflow-wrap: anywhere; }
.shop__office { color: var(--text-3); font-size: var(--fs-1); }
.shop__actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); }
.shop__actions .btn { width: 100%; justify-content: center; }
.shop__actions--row { grid-template-columns: 1fr 1fr; max-width: 32rem; }
.shop__disclosure { margin-top: var(--sp-2); }
.shop__empty { border: 1px dashed var(--border-2); border-radius: var(--r-xl); padding: var(--sp-10) var(--sp-6); text-align: center; color: var(--text-2); background: var(--surface-1); }
.shop__empty h2 { margin: 0 0 var(--sp-2); color: var(--text-1); }
.shop__ok { color: var(--ok); margin: 0; }

/* Saved searches. */
.shop__chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: var(--fs-2); }
.shop__chips:empty { display: none; }
.shop__chip { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r-pill); overflow: hidden; background: var(--surface-1); }
.shop__chip button { background: none; border: 0; color: var(--text-1); padding: var(--sp-1) var(--sp-3); cursor: pointer; font: inherit; }
.shop__chip button:first-child { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop__chip .shop__x, .shop__x { padding: var(--sp-1) var(--sp-2); color: var(--text-2); border: 0; background: none; cursor: pointer; font-size: var(--fs-5); }
.shop__chip .shop__x { border-left: 1px solid var(--border-2); font-size: var(--fs-3); }

/* One home. */
.shop__overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: start center; overflow-y: auto; padding: var(--sp-6) var(--sp-3); z-index: 50; }
.shop__detail { background: var(--surface-1); color: var(--text-1); border-radius: var(--r-xl); padding: var(--sp-5); width: min(52rem, 100%); display: grid; gap: var(--sp-3); box-shadow: var(--shadow-2); }
.shop__detail h2 { margin: 0; font-size: var(--fs-5); color: var(--text-2); }
.shop__close { justify-self: start; }
.shop__facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-1) var(--sp-4); margin: 0; }
.shop__facts dt { color: var(--text-2); }
.shop__facts dd { margin: 0; }
.shop__remarks { white-space: pre-line; margin: 0; }
.shop__thumbs { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-1); }
.shop__thumb { flex: 0 0 auto; width: 96px; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--border-2); border-radius: var(--r-md); overflow: hidden; background: none; cursor: pointer; }
.shop__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop__send { display: grid; gap: var(--sp-2); border-top: 1px solid var(--border-1); padding-top: var(--sp-3); }
.shop__send select, .shop__send input { flex: 1 1 12rem; }
.shop__cta { border: 1px solid var(--accent); border-radius: var(--r-xl); padding: var(--sp-4); display: grid; gap: var(--sp-2); justify-items: start; background: var(--accent-soft); }
.shop__cta p { margin: 0; }
.shop__more { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border-1); padding-top: var(--sp-3); }
.shop__more small { flex-basis: 100%; color: var(--text-2); }

/* Phones: filters become a drawer behind a row of chips. */
@media (max-width: 56rem) {
  .mkt__top { grid-template-columns: 1fr auto; gap: var(--sp-3); }
  .mkt__search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .mkt__cart span:not(.mkt__count) { display: none; }
  .mkt__nav { flex-wrap: wrap; padding-bottom: var(--sp-2); }
  .shop__layout { grid-template-columns: 1fr; }
  .shop__chiprow { display: flex; }
  .shop__filters { position: fixed; inset: 0 auto 0 0; width: min(22rem, 88vw); z-index: 60; overflow-y: auto; border-radius: 0 var(--r-xl) var(--r-xl) 0; transform: translateX(-105%); transition: transform 0.2s; align-content: start; }
  .shop__filters--open { transform: none; }
  .shop__drawerhead { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-1); font-family: var(--display); font-size: var(--fs-5); }
  .shop--drawer .shop__scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 55; }
  .shop__heading h1 { font-size: var(--fs-6); }
  .shop__grid { grid-template-columns: 1fr; }
  .shop__actions--row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .shop__filters { transition: none; } }

/* ---- The agent's Homes pages ------------------------------------------- */
.homes__tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; border-bottom: 1px solid var(--border-2); }
.homes__tab { padding: var(--sp-2) var(--sp-3); color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; }
.homes__tab--on { color: var(--text-1); border-bottom-color: var(--accent); font-weight: 600; }
.homes__shop .shop__heading h1 { font-size: var(--fs-6); }
.mk__charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--sp-4); }
.mk__chart { margin: 0; border: 1px solid var(--border-2); border-radius: var(--r-xl); padding: var(--sp-3); }
.mk__chart figcaption { font-weight: 600; margin-bottom: var(--sp-2); }
.mk__bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-1); align-items: end; height: 9rem; }
.mk__bar { display: grid; grid-template-rows: auto 1fr auto; height: 100%; align-items: end; text-align: center; min-width: 0; }
.mk__fill { background: var(--accent); border-radius: var(--r-sm) var(--r-sm) 0 0; min-height: 2px; align-self: end; }
.mk__val { font-size: var(--fs-1); color: var(--text-2); white-space: nowrap; overflow: hidden; }
.mk__mon { font-size: var(--fs-1); color: var(--text-2); }

/* ---- A brokerage's site ------------------------------------------------- */
.site__hero { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.site__hero p { margin: var(--sp-1) 0 0; color: var(--text-2); font-size: var(--fs-4); }
.site__attr { margin-top: var(--sp-4); }
.mkt .re__card { border: 1px solid var(--border-1); border-radius: var(--r-xl); padding: var(--sp-5); background: var(--surface-1); display: grid; gap: var(--sp-3); }
@media (max-width: 56rem) {
  .mkt__brand { font-size: var(--fs-5); }
  .mkt__right .btn { height: var(--ctl-sm); }
  .mkt__cta { display: none; }
}

/* /demo: try it as an agent or as a home buyer. */
.demo-page { margin: 0; background: var(--surface-0); color: var(--text-1); font-family: var(--text); font-size: var(--fs-3); }
.demo { max-width: 68rem; margin: 0 auto; padding: var(--sp-6) var(--gutter) var(--sp-10); }
.demo__top { padding-bottom: var(--sp-6); }
.demo__logo { height: 40px; display: block; }
.demo__hero h1 { font-family: var(--display); font-size: clamp(var(--fs-6), 4vw, 2.5rem); line-height: 1.15; margin: 0 0 var(--sp-3); }
.demo__hero p { font-size: var(--fs-4); color: var(--text-2); max-width: 44rem; margin: 0 0 var(--sp-6); }
.demo__running { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-6); background: var(--accent-soft); border-radius: var(--r-lg); }
.demo__running span { flex: 1 1 16rem; }
.demo__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--sp-5); }
.demo__card { display: flex; flex-direction: column; padding: var(--sp-6); background: var(--surface-1); border: 1px solid var(--border-1); border-radius: var(--r-xl); box-shadow: var(--shadow-1); }
.demo__card h2 { font-family: var(--display); font-size: var(--fs-6); margin: 0 0 var(--sp-1); }
.demo__who { color: var(--text-2); margin: 0 0 var(--sp-4); }
.demo__points { margin: 0 0 var(--sp-6); padding-left: var(--sp-5); line-height: 1.6; flex: 1; }
.demo__go { height: 44px; font-size: var(--fs-4); }
.demo__status { min-height: 1.4em; margin: var(--sp-2) 0 0; color: var(--text-2); font-size: var(--fs-2); }
.demo__tour { margin-top: var(--sp-8); padding: var(--sp-6); background: var(--surface-1); border: 1px solid var(--border-1); border-radius: var(--r-xl); }
.demo__tour h2 { font-family: var(--display); font-size: var(--fs-5); margin: 0 0 var(--sp-3); }
.demo__tour ol { margin: 0; padding-left: var(--sp-5); line-height: 1.7; }
.demo__fine { margin-top: var(--sp-6); color: var(--text-3); font-size: var(--fs-2); max-width: 48rem; }
