.parcel-list {
  display: flex;
  flex-direction: column;
}

.parcel {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid transparent;
  border-bottom-color: var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.parcel:hover,
.parcel.is-active {
  background-color: var(--color-land-soft);
  border-color: var(--color-land);
}

.parcel--saved.is-active,
.parcel--saved:hover {
  background-color: var(--color-saved-soft);
  border-color: var(--color-saved);
}

/* Wider than the plot alone needed: the drawing now holds a strip of the street
   around it, and the plot has to stay readable inside that. */
.parcel__thumb {
  flex: none;
  width: 5rem;
}

.parcel__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.parcel__address {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.parcel__meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.parcel__note {
  padding: var(--space-2xs) var(--space-xs);
  border-left: 2px solid var(--color-border-strong);
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  white-space: pre-line;
}

.parcel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: var(--space-3xs);
}

.parcel__save {
  margin-top: var(--space-xs);
}

.parcel__save[hidden] {
  display: none;
}

/* Outline of the plot, with its buildings — enough to recognise a plot at a glance */
.parcel-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-sunken);
}

/* What stands around the plot, drawn flat and grey. It answers the question the
   outline alone cannot — is the house attached to the one next door — and it
   has to lose every argument for attention against the plot itself. */
.parcel-thumb__context {
  fill: rgb(22 24 29 / 0.1);
  stroke: var(--color-border-strong);
  stroke-width: 1;
}

.parcel-thumb__land {
  fill: rgb(37 99 235 / 0.12);
  stroke: var(--color-land);
  stroke-width: 2;
}

.parcel-thumb__building {
  fill: rgb(220 38 38 / 0.25);
  stroke: var(--color-building);
  stroke-width: 1.5;
}

/* Wraps as well: three figures and a price are more than a narrow card holds on
   one line, and the row has no business setting the card's width. */
.figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.figures__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3xs);
}

.figures__item--land {
  color: var(--color-land);
}

.figures__item--building {
  color: var(--color-building);
}

/* À l'encre du texte, comme le prix : la surface habitable est le chiffre par
   lequel une annonce se compare, pas une mesure de plus du terrain ou du bâti. */
.figures__item--living {
  color: var(--color-text);
}

.figures__label {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}

.badge {
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.badge--saved {
  background-color: var(--color-saved-soft);
  color: var(--color-saved);
}

/* Sunken, to set what you are filling in apart from the card you are filling it
   in from — which means the fields have to step the other way. Left tinted they
   would be four levels off their own background and disappear into it. */
.save-form {
  --color-field: var(--color-surface);

  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-sunken);
}

/* `.subfield` is sized to share a row, where its 8rem basis is a width. Standing
   alone in this column that basis becomes a height, and every labelled field
   here would reserve 8rem of it whatever it holds. */
.save-form > .subfield {
  flex: 0 0 auto;
}

.save-form__error {
  color: var(--color-danger);
  font-size: var(--text-sm);
}

.save-form__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.parcel__dpe {
  color: var(--color-text-soft);
  font-size: var(--text-xs);
}

/* The diagnosis answers the figures on the listing — the strongest signal a
   result can carry, so it reads differently from a merely informative one. */
.parcel__dpe--match {
  color: var(--color-saved);
  font-weight: var(--weight-semibold);
}

.figures__item--price {
  color: var(--color-text);
  font-weight: var(--weight-bold);
}


/* The official energy scale, A (green) through G (red). */
.dpe {
  display: inline-grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: var(--radius-sm);
  background-color: var(--dpe-background);
  color: var(--dpe-color, #fff);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1;
  vertical-align: middle;
}

.dpe--a { --dpe-background: #319834; }
.dpe--b { --dpe-background: #33cc31; --dpe-color: #10300f; }
.dpe--c { --dpe-background: #cbfc34; --dpe-color: #2c3a05; }
.dpe--d { --dpe-background: #fbfe06; --dpe-color: #3a3a05; }
.dpe--e { --dpe-background: #fbcc05; --dpe-color: #3a2e05; }
.dpe--f { --dpe-background: #fc9935; --dpe-color: #3d2103; }
.dpe--g { --dpe-background: #fc0205; }

/* Wraps: how many tags a card carries is the reader's choice, not the layout's,
   and a fourth one was pushing the row out through the side of the panel. */
.parcel__marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}

.stars {
  color: #f59e0b;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
}

.stars__empty {
  color: var(--color-border-strong);
}

.chip {
  padding: var(--space-4xs) var(--space-xs);
  border-radius: var(--radius-full);
  background-color: var(--color-surface-sunken);
  color: var(--color-text-soft);
  font-size: var(--text-xs);
}

/* Past transfers published by the tax administration. */
.sales {
  display: flex;
  flex-direction: column;
  gap: var(--space-4xs);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-sunken);
  font-size: var(--text-xs);
}

.sales__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
}

.sales__date {
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}

.sales__price {
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.sales__detail {
  color: var(--color-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ce à quoi la parcelle répond et ce qu'elle laisse sans réponse. Une seule
   rangée, dans l'ordre du formulaire : la fiche est classée par le nombre de ✓
   qu'elle porte, et cette rangée est la seule chose qui le montre. Discrète —
   c'est une justification, pas une donnée de plus sur le bien. */
.criteria {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-sm);
  font-size: var(--text-xs);
}

.criteria__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3xs);
}

.criteria__item--met {
  color: var(--color-saved);
}

/* Éteint plutôt que rouge : ce qui manque n'est pas une erreur du lecteur, et
   trois croix vives sur une fiche la feraient lire comme un rejet. */
.criteria__item--unmet {
  color: var(--color-text-faint);
}

.criteria__mark {
  font-weight: var(--weight-semibold);
}

/* The cadastre and the listing disagree about the ground. Marked, not hidden:
   the card is asking for a second look, and the figure it is asking about has
   to be the one under the reader's eye. */
.parcel__mismatch {
  color: var(--color-highlight);
  font-size: var(--text-xs);
}

/* A diagnosis is required to sell, and a plot rarely gets a second one — so a
   fresh one is worth pointing out, without pretending it proves anything. */
.parcel__signal {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}

.parcel__signal--recent {
  color: var(--color-highlight);
  font-weight: var(--weight-medium);
}

/* Full card width, on its own line.
   The Maps Embed API gives no way to hide its zoom buttons, address card or
   "open in Google Maps" link — and cropping them away would hide the
   attribution Google requires. They are fixed-size, though: at 112 px they
   swallowed the picture, at full width they sit in the corners of it. */
.street-view {
  flex: 1 0 100%;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-top: var(--space-2xs);
  border: 0;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-sunken);
}

/* Nothing to show. Keeps `.street-view` so the panorama switch hides the
   placeholder too, but drops the 16/10 box — a sentence does not need it. */
.street-view--empty {
  display: flex;
  gap: var(--space-2xs);
  align-items: center;
  justify-content: center;
  aspect-ratio: auto;
  padding: var(--space-sm);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-align: center;
}

.street-view__link {
  color: var(--color-text-soft);
  font-weight: var(--weight-medium);
}

/* Folded away unless this card says otherwise — the server opens the first plot
   of the answer and no other. Written as :not() rather than [data-street="off"]
   so a card with no attribute at all is closed too, and because it has to beat
   the `display: flex` of `--empty` above: hiding a panorama has to hide the
   sentence standing in for it as well.

   Because the iframes are lazy-loaded, a closed card never requests its picture
   at all — sixty results cost one panorama. */
.parcel:not([data-street="on"]) .street-view {
  display: none;
}

@media (max-width: 52rem) {
  /* Google's panorama swallows touch gestures. Two consequences on a phone:
     it must never be as tall as the panel, or there is nothing left to scroll
     with — and it needs gutters either side to land a thumb on. */
  .street-view {
    /* flex-grow must go back to 0, or the base `flex: 1 0 100%` stretches the
       panorama over the gutters again. */
    flex: 0 0 auto;
    /* The card already contributes its own --space-sm of padding, so the
       gutter left to add is the difference — a total inset of --space-xl. */
    width: calc(100% - 2 * (var(--space-xl) - var(--space-sm)));
    margin-inline: auto;
    aspect-ratio: auto;
    height: min(38svh, 14rem);
  }
}
