/* ============================================================
   Directory, community and offer pages (pages/content-pages/directory,
   renters/communities, offers). Loaded by layouts/content-page.blade.php
   after content-pages.css, and by nothing else. Plain CSS, no build step.
   The shared table, list and section rules live in content-pages.css.
   Classes: ard-* (directory tables), arof-* (the offers page).
   ============================================================ */

/* ---------- directory tables ---------- */
/* The median is the figure to read on the price index: one step heavier. */
.page-content .arc-table-scroll .ard-median {
  font-weight: 500;
}
/* A note under a data table keeps a gap from the table's frame. */
.page-content .arp-form-card + .arp-note {
  margin-top: 16px;
}
/* The companies list: the name column holds its width, the cities wrap. */
.page-content .ard-companies td:first-child {
  width: 36%;
}
/* Company profile (company-profile.blade.php, markup fixed by the offer
   switch-off fixture): its monthly price tables are the only tables with a
   caption, so their price column is set right-aligned as figures here. */
.page-content .arc-table-scroll table:has(> caption) th:nth-child(2),
.page-content .arc-table-scroll table:has(> caption) td:nth-child(2) {
  text-align: right;
  white-space: nowrap;
}

/* ---------- offers page ---------- */
.arof-alert {
  max-width: 960px;
  margin: 16px auto;
  padding: 12px 16px;
  border: 1px solid #b42318;
  border-left-width: 6px;
  border-radius: 6px;
  background: #fef3f2;
  color: #7a271a;
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
}
/* Below 1024px each offer is a bordered card, one under the other. */
.page-content .arof-offer {
  margin: 0;
  padding: 28px 28px 24px;
  background: #fff;
  border: 1px solid var(--ar-border);
  border-radius: 16px;
}
.page-content .arof-offer + .arof-offer {
  margin-top: 24px;
}
/* Company name in ink; its profile link turns teal and underlined on hover. */
.page-content .arof-company {
  margin: 0;
  font-weight: 700;
  font-size: 22px;
  line-height: 28px;
  color: var(--ar-ink);
  text-align: left;
}
.page-content .arof-company a {
  color: var(--ar-ink);
  text-decoration: none;
}
.page-content .arof-company a:hover {
  color: var(--ar-teal);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
/* The decision figure: the price large and bold, "a month" at body size. */
.page-content .arof-price {
  margin: 6px 0 20px;
  font-weight: 400;
  font-size: 16px;
  line-height: 34px;
  color: var(--ar-ink);
}
.page-content .arof-price strong {
  font-weight: 700;
  font-size: 28px;
  line-height: 34px;
}
/* The terms table inside a card: no second frame, one rule between rows.
   The other fees table keeps its framed table look (content-pages.css). */
.page-content .arof-offer .arof-termtable {
  border: 0;
  border-radius: 0;
  background: none;
}
.page-content .arof-offer .arof-termtable table th[scope="row"],
.page-content .arof-offer .arof-termtable td {
  padding: 10px 16px 10px 0;
  border-bottom: 0;
  border-top: 1px solid var(--ar-border);
}
.page-content .arof-offer .arof-termtable table th[scope="row"] {
  width: 45%;
  color: #5b5b5b;
}
.page-content .arof-offer > .arp-note {
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
}
.page-content .arof-offer .arc-table-scroll + .arp-note,
.page-content .arof-offer .arc-table-scroll + .arc-table-scroll {
  margin-top: 16px;
}
.page-content .arof-offer > .arof-form + .arp-note {
  margin-top: 12px;
}
.page-content .arof-choose {
  margin: 20px 0 0;
}

/* From 1024px: the offers side by side, one column per company. */
@media (min-width: 1024px) {
  .arof-board {
    display: grid;
    gap: 24px;
  }
  .arof-n1 {
    grid-template-columns: minmax(0, 560px);
  }
  .arof-n2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .arof-n3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .page-content .arof-board .arof-offer + .arof-offer {
    margin-top: 0;
  }
  .page-content .arof-board .arof-offer {
    display: flex;
    flex-direction: column;
  }
  .arof-board .arof-form {
    margin-top: auto;
  }
  .page-content .arof-board .arof-choose {
    width: 100%;
  }

  /* Terms: the label over its value, so a narrow column needs no second
     column. */
  .page-content .arof-board .arof-termtable table th[scope="row"],
  .page-content .arof-board .arof-termtable td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }
  .page-content .arof-board .arof-termtable table th[scope="row"] {
    font-size: 14px;
    line-height: 20px;
  }
  .page-content .arof-board .arof-termtable tr {
    display: block;
    padding: 10px 0;
    border-top: 1px solid var(--ar-border);
  }

  /* Other fees: one block per fee, its name first, then each value with its
     column label. The table's first header ("Other fees") stays as the
     block's label. */
  .page-content .arof-board .arof-feetable {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }
  .page-content .arof-board .arof-feetable table,
  .page-content .arof-board .arof-feetable thead,
  .page-content .arof-board .arof-feetable tbody,
  .page-content .arof-board .arof-feetable tr {
    display: block;
  }
  .page-content .arof-board .arof-feetable thead th {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .page-content .arof-board .arof-feetable thead th:first-child {
    position: static;
    width: auto;
    height: auto;
    padding: 10px 0 0;
    overflow: visible;
    clip: auto;
    border-top: 1px solid var(--ar-border);
    background: none;
    font-size: 14px;
    color: #5b5b5b;
  }
  .page-content .arof-board .arof-feetable tbody tr {
    padding: 8px 0;
  }
  .page-content .arof-board .arof-feetable tbody tr + tr {
    border-top: 1px solid var(--ar-border);
  }
  .page-content .arof-board .arof-feetable td,
  .page-content .arof-board .arof-feetable td:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
  }
  .page-content .arof-board .arof-feetable td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 50%;
    font-weight: 500;
    color: #5b5b5b;
    text-align: left;
  }
  .page-content .arof-board .arof-feetable td:first-child {
    display: block;
    font-weight: 500;
    text-align: left;
  }
  .page-content .arof-board .arof-feetable td:first-child::before {
    content: none;
  }

  /* Where subgrid is supported, every column shares one set of rows (name,
     price, the five terms, other fees, the button, the note), so each term
     lines up with the same term in the next column. */
  @supports (grid-template-rows: subgrid) {
    .page-content .arof-board .arof-offer {
      display: grid;
      grid-row: span 10;
      grid-template-rows: subgrid;
      row-gap: 0;
    }
    .page-content .arof-board .arof-termtable {
      display: contents;
    }
    .page-content .arof-board .arof-termtable table {
      display: grid;
      grid-row: span 5;
      grid-template-rows: subgrid;
      grid-template-columns: minmax(0, 1fr);
      row-gap: 0;
    }
    .page-content .arof-board .arof-termtable tbody {
      display: contents;
    }
    .page-content .arof-board .arof-offer .arc-table-scroll + .arp-note,
    .page-content .arof-board .arof-offer .arc-table-scroll + .arc-table-scroll {
      margin-top: 0;
      padding-top: 12px;
      border-top: 1px solid var(--ar-border);
    }
    .page-content .arof-board .arof-offer .arof-feetable {
      padding-top: 0;
      border-top: 0;
    }
    .arof-board .arof-form {
      margin-top: 0;
    }
  }
}

/* ---------- phone ---------- */
@media (max-width: 767px) {
  /* Stacked tables (arc-table-stack, content-pages.css) with a title cell:
     the first cell is the row's title, the others are label and value. */
  .page-content .ard-titled tbody td:first-child {
    display: block;
    padding: 10px 14px 2px;
    font-weight: 500;
    text-align: left;
  }
  .page-content .ard-titled tbody td:first-child::before {
    content: none;
  }
  .page-content .ard-companies td:first-child {
    width: auto;
  }
  /* The cities can be a long list: the label above it, the list left. */
  .page-content .ard-companies td[data-label] {
    display: block;
    text-align: left;
  }
  .page-content .ard-companies td[data-label]::before {
    display: block;
    max-width: none;
    font-size: 14px;
  }

  .page-content .arof-offer {
    padding: 22px 18px 20px;
  }
  .page-content .arof-offer .arof-termtable table th[scope="row"],
  .page-content .arof-offer .arof-termtable td {
    padding-left: 0;
    padding-right: 0;
  }
  /* Each term stacks: the label, then its value under it. */
  .page-content .arof-offer .arof-termtable table th[scope="row"] {
    width: auto;
    padding-bottom: 0;
  }
  .page-content .arof-offer .arof-termtable td {
    padding-top: 2px;
    border-top: 0;
  }
  .page-content .arof-choose {
    width: 100%;
  }
}
