/* Price list rows (added for the legal price list; the rules further down are
 * unchanged, so pages built earlier still look the same). */
.items .val {
  display: inline-block;
  text-align: right;
}

.items .from {
  display: block;
  font-size: .78rem;
  font-weight: 400;
  color: var(--muted);
}

.items .costs .from {
  display: inline;
}

.items .costs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: .88rem;
  color: var(--muted);
}

.items .costs li + li {
  margin-top: 2px;
}

.items .costs b {
  color: var(--text);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.items thead th:first-child {
  border-top-left-radius: 13px;
}

.items thead th:last-child {
  border-top-right-radius: 13px;
}

.items tbody tr:last-child td:first-child {
  border-bottom-left-radius: 13px;
}

.items tbody tr:last-child td:last-child {
  border-bottom-right-radius: 13px;
}

table.items {
  width: 100%;
  border-collapse: collapse;
}

.items th {
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.items td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.items tbody tr:last-child td {
  border-bottom: 0;
}

.items tbody tr:hover {
  background: color-mix(in srgb, var(--highlight) 6%, transparent);
}

.items .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.items .thumb {
  width: 112px;
  padding-right: 0;
}

.items .thumb img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.items .name {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.25;
}

.items .desc {
  font-size: .92rem;
  margin-top: 4px;
}

.items .desc p {
  margin: 0;
}

.price {
  font-weight: 700;
  color: var(--highlight);
  font-size: 1.1rem;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--st);
  background: color-mix(in srgb, var(--st) 14%, transparent);
}

.status.available {
  --st: var(--status-available);
}

.status.reserved {
  --st: var(--status-reserved);
}

.status.sold {
  --st: var(--status-sold);
}

.status.other {
  --st: var(--muted);
}

/* In a highlighted section the status colours are set for the page's surface, not the accent. */
.is-highlighted .status {
  background: var(--hl-paper);
}

.is-highlighted .status.other {
  --st: var(--hl-base);
}

/* Dimmed contents rather than whole cells, so a tooltip in the row isn't dimmed too. */
tr.is-sold td.num:not(.total),
tr.is-sold td.main > :not(.tip),
tr.is-sold td.total .val {
  opacity: .55;
}

.items .act {
  text-align: right;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
}

.pdf:hover {
  filter: brightness(1.12);
}

.pdf svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Cards instead of the table up to 1000 px: below that the table no longer
 * fits its box in every theme's font. */
@media (max-width: 1000px) {
  .table-wrap {
    background: none;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }
  table.items, .items tbody, .items tr, .items td {
    display: block;
  }
  .items thead {
    display: none;
  }
  .items tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 16px;
    padding-bottom: 8px;
  }
  .items tbody tr:hover {
    background: var(--surface);
  }
  .items td {
    border: 0;
    padding: 6px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .items td[data-label]::before {
    content: attr(data-label);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
  }
  .items td.main {
    display: block;
    padding-top: 16px;
  }
  .items .thumb {
    width: auto;
    padding: 0;
  }
  .items .thumb img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    border-radius: 0;
  }
  .items .act {
    display: block;
    padding-top: 12px;
  }
  .pdf {
    display: flex;
    justify-content: center;
  }
  .items td:empty {
    display: none;
  }
}

/* Sold units (offer history): greyed out, prices no longer highlighted. */
tr.is-sold .price {
  color: var(--muted);
}

tr.is-sold .name {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* Total price: the amount, and to its right the "Szczegóły…" button. Short
 * of room (a long amount in a narrow table or card), the button moves under
 * the amount instead of pushing past the edge. */
.total-cell {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 10px;
}

/* "Szczegóły…" tooltip: price history, then the extras. Opens on hover
 * (mouse), keyboard focus, or a tap (shared/tips/ adds .is-open). */
.tip {
  position: relative;
  display: inline-block;
}

.tip-btn {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  cursor: help;
}

.tip-btn:hover,
.tip.is-open .tip-btn {
  border-color: var(--highlight);
  color: var(--text);
}

.tip-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tip-box {
  position: absolute;
  bottom: calc(100% + 8px); /* above the button, so it covers the rows already read */
  z-index: 5;
  width: max-content;
  max-width: min(400px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  font-size: .85rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s, transform .15s, visibility 0s .15s;
}

.tip-end .tip-box {
  right: 0;
}

.tip.is-open .tip-box,
.tip:focus-within .tip-box {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .15s, transform .15s;
}

@media (hover: hover) {
  .tip:hover .tip-box {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .15s, transform .15s;
  }
}

.tip.is-dismissed .tip-box {
  visibility: hidden;
  opacity: 0;
}

.tip-section {
  display: block;
}

.tip-section + .tip-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tip-title {
  display: block;
  margin-bottom: 8px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Price history: four columns (date, price per m², price, total). */
.tip-grid {
  display: grid;
  grid-template-columns: auto auto auto auto;
  column-gap: 16px;
  font-variant-numeric: tabular-nums;
}

.tip-grid > span {
  padding: 4px 0;
  text-align: right;
  white-space: nowrap;
}

.tip-grid > span:nth-child(4n + 1) {
  text-align: left;
}

.tip-grid .th {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.tip-grid .now {
  font-weight: 700;
}

.tip-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tip-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.tip-list li + li {
  border-top: 1px solid var(--line);
}

.tip-price {
  white-space: nowrap;
  text-align: right;
}

.tip-price .from {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .tip-box {
    transition: none;
  }
}

/* Tablets: two cards side by side. */
@media (min-width: 641px) and (max-width: 1000px) {
  .items tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .items tbody tr {
    margin-bottom: 0;
  }
}

@media (max-width: 1000px) {

  .tip-grid {
    column-gap: 10px;
  }

  /* Cards: the "Szczegóły…" button goes left of the amount, so the amount
   * stays at the card's right edge in line with the other values. Its
   * tooltip spans the card's width rather than hanging off the button,
   * which now sits too far left for a box lined up with its right edge. */
  .items td.total {
    position: relative;
  }

  .items td.total .tip {
    position: static;
    order: -1;
  }

  .items td.total .tip-box {
    left: 18px;
    right: 18px;
    width: auto;
    max-width: none;
  }
}

/* Table layout (wider screens): fit the box in every theme's font. */
@media (min-width: 1001px) {
  .items th,
  .items td {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Every status badge is the same width: the column shrinks to its longest
   * label ("Zarezerwowany" in the page's font), and each badge fills it. */
  .items td.st {
    width: 1%;
  }

  .items td.st .status {
    width: 100%;
  }
}

/* Headers of the total price and status columns: centred over their column. */
.items th.total,
.items th.st {
  text-align: center;
}
