.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);
}

.parcel__thumb {
  flex: none;
  width: 4.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);
}

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

.figures {
  display: flex;
  gap: 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);
}

.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);
}

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

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

.parcel__marks {
  display: flex;
  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;
}

/* 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);
}

/* The cadastral reference and other technical figures: worth having, not worth
   a line of their own on every result. */
.info {
  display: inline-block;
}

.info__toggle {
  color: var(--color-text-faint);
  cursor: pointer;
  list-style: none;
}

.info__toggle::-webkit-details-marker {
  display: none;
}

.info__toggle:hover {
  color: var(--color-text);
}

.info__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4xs) var(--space-xs);
  margin-top: var(--space-3xs);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-sunken);
}

.info__list dt {
  color: var(--color-text-faint);
  white-space: nowrap;
}

.info__list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* 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);
}

/* Panoramas switched off: because they are lazy-loaded, hiding them means the
   images are never requested at all. A card can overrule the global setting
   either way — the more specific selector wins on its own, no !important. */
.no-panoramas .street-view {
  display: none;
}

.parcel[data-street="off"] .street-view {
  display: none;
}

.no-panoramas .parcel[data-street="on"] .street-view {
  display: block;
}

@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);
  }
}
