/*
 * Resale list and detail pages (CR-024). Loaded only on those pages through
 * the template's extra_css hook. Colours come from tokens.css only: Ink is the
 * one dark fill (current chip), Violet the primary button, no gradients.
 * Layout follows .playwright-mcp/mock-locality-1280.png and mock-detail-1280.png;
 * list pages follow the CR-027 owner mockups (filter column, one row per listing).
 */

/* ── List page ────────────────────────────────────────────────────────────── */
.rlist { padding: 18px 0 40px; }
.rlist__h1, .rdetail__h1 {
  font-size: 28px; line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; color: var(--sn-text);
}
.rlist__lead { margin-top: 10px; max-width: 680px; font-size: 16px; line-height: 1.5; color: var(--sn-text-muted); }

.rchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.rchip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--sn-border); border-radius: var(--sn-radius-pill);
  background: var(--sn-white); color: var(--sn-text); font-size: 14px; font-weight: 500;
  transition: border-color var(--sn-transition), color var(--sn-transition);
}
a.rchip:hover { border-color: var(--sn-violet); color: var(--sn-violet); }
.rchip--on { background: var(--sn-ink); border-color: var(--sn-ink); color: var(--sn-white); }

.rlist__h2 { margin-top: 28px; font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: -0.02em; color: var(--sn-text); }
.rlist__showing { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--sn-text-mute-2); }
.rempty { margin-top: 24px; }

.rgrid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.rcard {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--sn-border-soft); border-radius: var(--sn-radius-lg);
  background: var(--sn-white); overflow: hidden;
}
.rcard__media { display: block; aspect-ratio: 4 / 3; background: var(--sn-haze); }
.rcard__media img { width: 100%; height: 100%; object-fit: cover; }
.rcard__body { display: flex; flex-direction: column; gap: 10px; padding: 16px; flex: 1 1 auto; }
.rcard__price, .rbox__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; color: var(--sn-text); }
.rcard__price strong { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.rcard__price span, .rbox__price span { font-size: 13px; color: var(--sn-text-mute-2); }
.rcard__title { font-size: 16px; line-height: 1.35; font-weight: 600; }
.rcard__title a { color: var(--sn-text); }
.rcard__title a:hover { color: var(--sn-violet); }
.rcard__chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.rcard__chips li {
  padding: 4px 10px; border-radius: var(--sn-radius-pill);
  background: var(--sn-haze); color: var(--sn-text-muted); font-size: 13px;
}
.rcard__cta { margin-top: auto; }

/* The honesty line on seeded listings: a visible info line, not fine print. */
.rnote {
  padding: 8px 12px; border-radius: var(--sn-radius-sm);
  background: var(--sn-haze); border: 1px solid var(--sn-haze-border);
  font-size: 13px; line-height: 1.45; color: var(--sn-text-muted);
}

/* ── List layout, filter column, rows (CR-027) ────────────────────────────── */
/* Phone first: filters live in a bottom drawer (#rfilters, :target without JS),
   rows are vertical and minimal. From 720px: filter column left, one row per
   listing right. Colours from tokens.css only; no gradients. */
.rchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.rchips .rchip { flex: none; white-space: nowrap; min-height: 44px; }
.rlayout { margin-top: 16px; }
.rresults { min-width: 0; }
.rresults .rlist__h2 { margin-top: 0; }

.rfilters {
  display: none; background: var(--sn-white);
  border: 1px solid var(--sn-border); border-radius: var(--sn-radius-lg); padding: 16px;
}
.rfilters:target, .rfilters[data-open] {
  display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  max-height: 88vh; overflow-y: auto; border-radius: var(--sn-radius-xl) var(--sn-radius-xl) 0 0;
  padding: 16px 16px 0; animation: rdrawer 0.22s ease-out;
}
@keyframes rdrawer { from { transform: translateY(100%); } to { transform: none; } }
.rbackdrop { position: fixed; inset: 0; z-index: 999; background: var(--sn-ink); opacity: 0.55; }
.rfilters__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.rfilters__h2 { font-size: 18px; line-height: 1.3; font-weight: 700; color: var(--sn-text); }
.rfilters__close {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--sn-border); border-radius: var(--sn-radius-md); color: var(--sn-text); font-size: 15px; font-weight: 600;
}

.rff__fixed {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px;
  border-bottom: 1px solid var(--sn-border-hairline); font-size: 15px; color: var(--sn-text);
}
.rff__fixed a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.rfg { border-bottom: 1px solid var(--sn-border-hairline); }
.rfg summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px;
  cursor: pointer; list-style: none; font-size: 15px; font-weight: 600; color: var(--sn-text);
}
.rfg summary::-webkit-details-marker { display: none; }
.rfg summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px;
  border-right: 2px solid var(--sn-text-mute-3); border-bottom: 2px solid var(--sn-text-mute-3); transform: rotate(45deg);
}
.rfg[open] summary::after { transform: rotate(-135deg); }
.rfg__sum { min-width: 0; overflow-wrap: anywhere; }
.rfg__body { border: 0; margin: 0; padding: 0 0 12px; min-width: 0; max-height: 330px; overflow-y: auto; }
.rfg__hint { margin-bottom: 4px; font-size: 13px; line-height: 1.45; color: var(--sn-text-mute-2); }
.rfg__opt { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; color: var(--sn-text); cursor: pointer; }
.rfg__opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--sn-violet); }
.rfg__range { display: flex; gap: 8px; }
.rfg__range label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--sn-text-mute-2); }
.rfg__range input, .rsort select {
  min-height: 44px; width: 100%; padding: 0 10px; border: 1px solid var(--sn-border); border-radius: var(--sn-radius-md);
  background: var(--sn-white); color: var(--sn-text); font-family: inherit; font-size: 16px;
}
.rfilters__foot {
  display: flex; gap: 8px; padding: 14px 0 16px; background: var(--sn-white);
  position: sticky; bottom: 0;
}
.rfilters__foot .btn { flex: 1; min-height: 48px; padding: 0 12px; white-space: nowrap; }

.rbar { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.rbar__filters { flex: 1; min-height: 48px; }
.rsort { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rsort__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rsort select { min-height: 48px; flex: 1; min-width: 0; font-size: 15px; }
.rsort__go { min-height: 48px; }
.rsort__go[hidden] { display: none; }

/* One scrolling row of quick chips (first filters of the page's order), so the first listing stays on screen. */
.rquick, .ractive { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 8px; }
.rquick { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.rquick li { flex: none; }
.ractive { flex-wrap: wrap; align-items: center; }
.rtsec + .rtsec { margin-top: 28px; }
.rtsec .rlist__h2 { margin-top: 0; }
.rtsec__more { margin-top: 12px; font-size: 15px; font-weight: 600; }
.rtsec__more a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.rpill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; white-space: nowrap;
  border: 1px solid var(--sn-haze-border); border-radius: var(--sn-radius-pill);
  background: var(--sn-haze); color: var(--sn-text); font-size: 14px; font-weight: 500;
}
a.rpill:hover { border-color: var(--sn-violet); color: var(--sn-text); }
.rpill--on { background: var(--sn-ink); border-color: var(--sn-ink); color: var(--sn-white); }
a.rpill--on:hover { color: var(--sn-white); }
.ractive__clear { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-size: 14px; font-weight: 600; }

.rnomatch { margin-top: 16px; padding: 24px; border: 1px solid var(--sn-border); border-radius: var(--sn-radius-lg); background: var(--sn-haze); }
.rnomatch__h { font-size: 20px; font-weight: 800; color: var(--sn-text); }
.rnomatch__p { margin-top: 6px; font-size: 15px; color: var(--sn-text-muted); }
.rnomatch__do { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.rrows { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.rrow {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid var(--sn-border); border-radius: var(--sn-radius-lg); background: var(--sn-white);
}
.rrow:hover { border-color: var(--sn-violet-border); }
.rrow:focus-within { outline: 2px solid var(--sn-violet); outline-offset: 2px; }
.rrow__media { position: relative; aspect-ratio: 4 / 3; background: var(--sn-violet-photo-tint); }
.rrow__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rrow__tag, .rrow__stock { position: absolute; left: 10px; font-size: 12px; line-height: 1.4; font-weight: 700; }
.rrow__tag { top: 10px; padding: 4px 10px; border-radius: var(--sn-radius-pill); background: var(--sn-violet-photo-tint); color: var(--sn-ink); }
.rrow--com .rrow__tag { background: var(--sn-mint); color: var(--sn-text-on-mint); }
.rrow__stock { bottom: 10px; padding: 3px 8px; border-radius: var(--sn-radius-sm); background: var(--sn-ink); color: var(--sn-white); font-weight: 600; }
.rrow__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.rrow__head { display: flex; flex-direction: column; gap: 4px; }
.rrow__price { order: -1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; color: var(--sn-text); }
.rrow__price strong { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.rrow__price span { font-size: 13px; color: var(--sn-text-mute-2); }
.rrow__title { font-size: 15px; line-height: 1.35; font-weight: 700; }
.rrow__link { color: var(--sn-text); }
.rrow__link:hover { color: var(--sn-violet); }
.rrow__link:focus-visible { outline: none; }
/* Phone: the whole card is the title link. */
.rrow__link::after { content: ""; position: absolute; inset: 0; }
.rrow__where { font-size: 14px; color: var(--sn-text-muted); }
.rrow__long, .rrow__facts, .rrow__tags, .rrow__note, .rrow__do { display: none; }
.rtag { display: inline-flex; padding: 3px 8px; border-radius: var(--sn-radius-pill); background: var(--sn-haze); color: var(--sn-text-muted); font-size: 12px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .rfilters:target, .rfilters[data-open] { animation: none; }
}

@media (min-width: 720px) {
  .rchips { flex-wrap: wrap; overflow: visible; }
  .rlayout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
  .rfilters, .rfilters:target, .rfilters[data-open] {
    display: block; position: sticky; top: 16px; left: auto; right: auto; bottom: auto; z-index: auto;
    max-height: calc(100vh - 32px); overflow-y: auto; border-radius: var(--sn-radius-lg); padding: 16px 16px 0; animation: none;
  }
  .rfilters__close, .rbar__filters, .rquick, .rbackdrop { display: none; }
  .rtop { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
  .rbar { margin-top: 0; margin-left: auto; }
  .rsort { flex: none; width: 310px; }
  .rsort__label { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 14px; color: var(--sn-text-mute-2); }
  .rsort select { min-height: 44px; }

  .rrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .rrow__media { aspect-ratio: auto; min-height: 220px; }
  .rrow__body { gap: 10px; padding: 18px 20px; }
  .rrow__title { font-size: 17px; }
  .rrow__link::after { content: none; }
  .rrow__link:focus-visible { outline: 2px solid var(--sn-violet); outline-offset: 2px; }
  .rrow:focus-within { outline: none; }
  .rrow__long { display: inline; }
  .rrow__short { display: none; }
  .rrow__facts {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 2px 0 0; padding: 10px 0;
    border-top: 1px solid var(--sn-border-hairline); border-bottom: 1px solid var(--sn-border-hairline);
  }
  .rrow__facts dt { font-size: 12px; color: var(--sn-text-faint); }
  .rrow__facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--sn-text); }
  .rrow__tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .rrow__note { display: block; }
  .rrow__do { display: flex; margin-top: auto; }
}
@media (min-width: 1000px) {
  .rlayout { grid-template-columns: 290px minmax(0, 1fr); gap: 32px; }
  .rrow__head { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 16px; }
  .rrow__price { order: 0; flex: none; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
  .rrow__price strong { font-size: 24px; }
  .rrow__facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.rpager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; }
.rpager ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rpager a, .rpager span, .rpager__gap {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px;
  border-radius: var(--sn-radius-md); font-size: 15px; font-weight: 600;
}
.rpager a { border: 1px solid var(--sn-border); color: var(--sn-text); background: var(--sn-white); }
.rpager a:hover { border-color: var(--sn-violet); color: var(--sn-violet); }
.rpager span[aria-current] { background: var(--sn-ink); color: var(--sn-white); }
.rpager__gap { min-width: 24px; padding: 0; color: var(--sn-text-mute-3); }

/* ── Lower sections ───────────────────────────────────────────────────────── */
.rsec { padding: 28px 0; border-top: 1px solid var(--sn-border-hairline); }
.rsec--last { padding-bottom: 48px; }
.rsec__title { font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: -0.02em; color: var(--sn-text); }
.rsec__up { margin-top: 8px; font-size: 15px; font-weight: 600; }
.rsec__small { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--sn-text-mute-2); }
.rplaces { list-style: none; margin-top: 14px; display: grid; gap: 8px 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rplaces li { font-size: 15px; line-height: 1.4; }
.rplaces span { color: var(--sn-text-mute-3); font-size: 13px; }

.rtable-wrap { margin-top: 14px; overflow-x: auto; }
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 460px; }
.rtable th, .rtable td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--sn-border-hairline); }
.rtable thead th { font-size: 13px; font-weight: 600; color: var(--sn-text-mute-2); background: var(--sn-haze); }
.rtable tbody th { font-weight: 600; color: var(--sn-text); }

.rfaq { margin-top: 12px; max-width: 820px; }
.rfaq details { border-bottom: 1px solid var(--sn-border-hairline); }
.rfaq summary { padding: 14px 0; font-size: 16px; font-weight: 600; cursor: pointer; color: var(--sn-text); }
.rfaq p { padding: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--sn-text-muted); }

.rrent { font-size: 15px; color: var(--sn-text-muted); }
.rrent a { font-weight: 600; }

/* ── Detail page ──────────────────────────────────────────────────────────── */
.rdetail { padding: 18px 0 32px; }
/* Phone: photos, then price and form, then the facts. Desktop: the box sits beside both. */
.rdetail__grid {
  display: grid; gap: 24px; margin-top: 18px; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "media" "box" "main";
}
.rdetail__media { grid-area: media; min-width: 0; }
.rdetail__main { grid-area: main; min-width: 0; }
.rbox { grid-area: box; }
.rdetail__main .spec { margin-top: 0; }

.rgallery { margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rgallery__item { display: block; min-width: 0; }
.rgallery__item img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--sn-radius-md); aspect-ratio: 4 / 3; }
.rgallery__item:first-child { grid-column: 1 / -1; }
.rgallery--2 .rgallery__item:last-of-type { grid-column: 1 / -1; }
.rgallery__cap { grid-column: 1 / -1; font-size: 13px; color: var(--sn-text-mute-2); }

.spec {
  margin-top: 20px; display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--sn-border-soft); border: 1px solid var(--sn-border-soft); border-radius: var(--sn-radius-lg); overflow: hidden;
}
.spec__item { background: var(--sn-white); padding: 12px 16px; min-width: 0; }
/* Two columns on phones: an odd last fact takes the full row, so no empty grey cell. */
.spec__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
.spec dt { font-size: 13px; color: var(--sn-text-mute-2); }
.spec dd { margin-top: 2px; font-size: 16px; font-weight: 600; color: var(--sn-text); overflow-wrap: anywhere; }

.rdetail__h2 { margin-top: 28px; font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: -0.02em; color: var(--sn-text); }
.rdetail__p { margin-top: 10px; max-width: 720px; font-size: 16px; line-height: 1.6; color: var(--sn-text-muted); }
.rdetail__context { color: var(--sn-text); }
.rsteps { margin: 12px 0 0; padding-left: 22px; max-width: 720px; }
.rsteps li { margin-top: 8px; font-size: 16px; line-height: 1.55; color: var(--sn-text-muted); }
.rsteps strong { color: var(--sn-text); }

.rbox {
  align-self: start; padding: 20px; border: 1px solid var(--sn-border-soft); border-radius: var(--sn-radius-lg);
  background: var(--sn-white); display: flex; flex-direction: column; gap: 10px;
}
.rbox__price strong { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.rbox__extra { font-size: 13px; color: var(--sn-text-mute-2); }
.rform { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.rform__field { display: flex; flex-direction: column; gap: 6px; }
.rform__field[hidden] { display: none; }
.rform label { font-size: 14px; font-weight: 600; color: var(--sn-text); }
.rform input {
  height: 48px; width: 100%; padding: 0 14px; border: 1px solid var(--sn-border); border-radius: var(--sn-radius-md);
  font-family: inherit; font-size: 16px; color: var(--sn-text); background: var(--sn-white);
}
.rform input[aria-invalid="true"] { border-color: #B3261E; }
.rform__err { font-size: 14px; color: #B3261E; }
.rform__msg { padding: 10px 12px; border-radius: var(--sn-radius-sm); background: var(--sn-haze); font-size: 15px; color: var(--sn-text); }
.rform__msg--ok { background: var(--sn-mint); color: var(--sn-text-on-mint); font-weight: 600; }
.rform__small { font-size: 13px; line-height: 1.5; color: var(--sn-text-mute-2); }

.rmore { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }

/* ── Wider screens ────────────────────────────────────────────────────────── */
@media (min-width: 700px) {
  .rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rplaces { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spec { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spec__item:last-child:nth-child(odd) { grid-column: auto; }
  .rgallery { grid-template-columns: 2fr 1fr; }
  .rgallery__item:first-child { grid-column: 1; grid-row: 1 / span 2; }
  .rgallery--2 .rgallery__item:last-of-type { grid-column: 2; grid-row: 1 / span 2; }
  .rgallery__item:first-child img { aspect-ratio: auto; }
  .rgallery--2 .rgallery__item:last-of-type img { aspect-ratio: auto; }
}
@media (min-width: 1000px) {
  .rlist__h1, .rdetail__h1 { font-size: 40px; line-height: 1.08; }
  .rlist__lead { font-size: 18px; }
  .rlist__h2, .rsec__title, .rdetail__h2 { font-size: 22px; }
  .rgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .rplaces { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rdetail__grid { grid-template-columns: minmax(0, 1fr) 400px; grid-template-areas: "media box" "main box"; gap: 20px 32px; }
  .rbox { position: sticky; top: 24px; }
}
