/* HDB pages. The main site's look: numbered tiles for "on this page" (www's decision
   steps), white hairline tables with a navy head row, square block tiles, and the seller
   call to action as www's full-width closing band. Mobile first; no sideways scrolling at
   375px.
   Colours come from the --c-* custom properties the layout sets from the brand config
   (src/brand.js); nothing brand-specific is written here. */

/* "On this page" */

.hdb-toc {
  margin: 0 0 52px;
}

.hdb-toc ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  background: color-mix(in srgb, var(--c-primary) 27%, transparent);
  list-style: none;
}

.hdb-toc li {
  min-width: 0;
  max-width: none;
}

.hdb-toc a {
  display: grid;
  height: 100%;
  min-height: 68px;
  align-content: center;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 0;
  background: var(--c-surface);
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 180ms ease;
}

.hdb-toc a:hover {
  background: var(--c-raised);
}

.hdb-toc b {
  color: var(--c-accent);
  font-size: 12px;
}

/* Tables */

.hdb-total {
  margin: 0 0 18px;
  color: var(--c-ink);
  font-weight: 700;
}

.hdb-table-short {
  max-width: 760px;
}

.hdb-table th[scope="row"] {
  font-weight: 800;
}

.hdb-table th[scope="row"] a {
  font-weight: 800;
}

/* The block table and the MOP tracker's tables fit a 375px screen: tighter cells, headers
   may wrap. From 761px they take www's table spacing (site.css). */
.hdb-resales th,
.hdb-resales td,
.hdb-mop th,
.hdb-mop td {
  padding: 11px 7px;
  font-size: 13px;
}

.hdb-mop td:last-child {
  white-space: nowrap;
}

/* Each block's link to the main site's HDB Valuation tool, on its own line under the block's
   name (in the row's own cell, so the tables keep their width on a phone). The arrow says it
   opens a page on the main site. */
.hdb-mop .hdb-mop-value {
  display: block;
  margin-top: 6px;
}

.hdb-table th[scope="row"] .hdb-mop-link {
  border-bottom: 1px solid currentColor;
  color: var(--c-link);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.hdb-mop-link::after {
  content: "\00a0\2197";
  content: "\00a0\2197" / "";
}

/* With www's column lines the four-column MOP table needs a little less side padding to
   fit 343px. */
.hdb-mop th,
.hdb-mop td {
  padding-right: 5px;
  padding-left: 5px;
}

/* Cells stay on one line ("5-room" never breaks at its hyphen); a rare long flat type
   scrolls inside the table box. */
.hdb-resales td {
  white-space: nowrap;
}

/* The storey table can be wider than a phone: the storey column stays in view. Its
   column line is drawn by the cell itself (a shared table border would not move with it). */
.hdb-storeys th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 0;
  background: var(--c-raised);
  box-shadow: inset -1px 0 0 var(--c-line);
  white-space: nowrap;
}

.hdb-storeys thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 0;
  box-shadow: inset -1px 0 0 var(--c-line);
}

.hdb-storeys td {
  white-space: nowrap;
}

.hdb-n {
  color: var(--c-muted);
  font-size: 0.85em;
  font-weight: 600;
}

/* MOP tracker: the count before the tables */

.hdb-intro {
  max-width: 760px;
  margin: 0 0 52px;
}

.hdb-intro p:first-child {
  color: var(--c-ink);
  font-size: 19px;
  line-height: 1.55;
}

.hdb-intro p:last-child {
  margin-bottom: 0;
  color: var(--c-muted);
  font-size: 16px;
}

/* The hero panel: this block's facts, or the MOP tracker's method */

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

.hdb-facts li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  max-width: none;
  margin: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--c-line-on-primary);
  color: var(--c-on-primary);
  font-size: 15px;
  font-weight: 700;
}

.hdb-facts li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hdb-facts span {
  color: var(--c-eyebrow-on-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hdb-facts a {
  border-bottom: 1px solid var(--c-line-on-primary);
  color: var(--c-on-primary);
  transition: border-color 180ms ease;
}

.hdb-facts a:hover {
  border-bottom-color: currentColor;
}

/* The block pages' button to the main site's HDB Valuation tool: www's light button, right
   under the "This block" panel and as wide as it, on every screen size. */
.hdb-valuation {
  max-width: none;
  margin: 12px 0 0;
}

.hdb-valuation .button {
  width: 100%;
}

/* The town pages' plain link to the same tool, under the hero's intro: www's text link, in
   white on the navy hero. */
.hdb-hero-link {
  margin: 0;
}

.page-hero .hdb-hero-link .text-link {
  border-bottom-color: currentColor;
  color: var(--c-on-primary);
}

/* The postal code box on /hdb/ and the town pages: a hero panel holding a GET form to the
   main site's HDB Valuation tool. The field and www's light button share one row, and stack
   on a narrow screen. */
.hdb-postal label {
  color: var(--c-on-primary);
}

.hdb-postal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hdb-postal-row input {
  flex: 1 1 9em;
  min-width: 0;
  border-color: transparent;
  font-size: 17px;
  letter-spacing: 0.08em;
}

.hdb-postal-row .button {
  flex: 1 1 10em;
  width: auto;
}

.hdb-postal-hint {
  margin: 12px 0 0;
  color: var(--c-intro-on-primary);
  font-size: 14px;
}

/* The block pages' past resales in brief: four plain figures in www's hairline boxes, two
   to a row from 761px. */
.hdb-keyfacts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  max-width: 760px;
  margin: 0;
  padding: 1px;
  background: var(--c-line);
}

.hdb-keyfacts > div {
  min-width: 0;
  padding: 18px 20px;
  background: var(--c-raised);
}

.hdb-keyfacts dt {
  margin: 0 0 8px;
  color: var(--c-link);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hdb-keyfacts dd {
  margin: 0;
  color: var(--c-muted);
  font-size: 14px;
  line-height: 1.5;
}

.hdb-keyfacts strong {
  display: block;
  margin-bottom: 4px;
  color: var(--c-primary);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

/* www's service promise: gold label, then the line in the serif face */
.hdb-approx {
  margin: 0;
  color: var(--c-on-primary);
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.35;
}

.hdb-approx strong {
  display: block;
  margin-bottom: 18px;
  color: var(--c-accent-on-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* Blocks, street by street */

.hdb-streets {
  border-top: 1px solid var(--c-line);
}

.hdb-street-group {
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--c-line);
}

.page-body .hdb-street {
  margin: 0 0 14px;
  font-size: 22px;
}

.hdb-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hdb-blocks li {
  max-width: none;
}

.page-body .hdb-blocks a {
  display: inline-flex;
  min-width: 48px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--c-line);
  background: var(--c-raised);
  color: var(--c-primary);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.page-body .hdb-blocks a:hover {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: var(--c-on-primary);
}

/* The seller call to action: www's closing band (.final-cta), full width like the
   sections around it (site.css). On phones one column: label, heading, the line about the
   plan, then a full-width button. From 761px, www's grid. */

.hdb-cta {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 60px 0;
  background: var(--c-band);
  box-shadow: 0 0 0 100vmax var(--c-band);
  clip-path: inset(0 -100vmax);
  color: var(--c-on-primary);
  isolation: isolate;
}

/* The band ends the body: it sits flush on the consult band. */
.page-body > .shell > .hdb-cta:last-child {
  margin-bottom: -52px;
}

.hdb-cta + .pd-section {
  padding-top: 52px;
}

.hdb-cta::after {
  content: "";
  position: absolute;
  top: -120px;
  right: 8%;
  z-index: -1;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.hdb-cta .eyebrow {
  margin: 0;
}

.page-body .hdb-cta h2 {
  max-width: none;
  margin: 0;
  color: var(--c-on-primary);
  font-size: var(--t-section-size);
}

.hdb-cta-copy p {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--c-intro-on-primary);
  font-size: 16px;
}

.hdb-cta-action {
  margin: 35px 0 0;
}

/* Trend chart */

.hdb-chart {
  max-width: 640px;
  margin: 0;
  padding: 20px 16px 16px;
  border: 1px solid var(--c-line);
  background: var(--c-raised);
}

.hdb-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--c-primary);
}

.hdb-chart-line {
  fill: none;
  stroke: var(--c-primary);
  stroke-width: 2;
}

.hdb-chart-dot {
  fill: var(--c-primary);
  stroke: var(--c-raised);
  stroke-width: 2;
}

.hdb-chart-grid {
  stroke: var(--c-line);
  stroke-width: 1;
}

.hdb-chart-text {
  fill: var(--c-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hdb-chart-value {
  fill: var(--c-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
}

.hdb-chart figcaption {
  margin-top: 10px;
  color: var(--c-muted);
  font-size: 13px;
}

.hdb-chart-data {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--c-line);
}

.hdb-chart-data summary {
  display: inline-flex;
  width: fit-content;
  padding: 4px 0;
  border-bottom: 1px solid var(--c-primary);
  color: var(--c-primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.hdb-chart-data[open] summary {
  margin-bottom: 14px;
}

.hdb-chart-data .table-wrap {
  margin-bottom: 0;
}

@media (min-width: 761px) {
  .hdb-toc {
    margin-bottom: 72px;
  }

  .hdb-toc ul {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hdb-toc a {
    min-height: 82px;
    padding: 14px;
  }

  .hdb-resales th,
  .hdb-resales td,
  .hdb-mop th,
  .hdb-mop td {
    font-size: 14px;
  }

  .hdb-resales thead th,
  .hdb-mop thead th {
    padding: 18px 14px;
  }

  .hdb-resales tbody td,
  .hdb-mop tbody td {
    padding: 15px 14px;
  }

  .hdb-mop tbody th {
    padding: 17px 20px;
  }

  .hdb-intro {
    margin-bottom: 72px;
  }

  .hdb-keyfacts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Three figures (a block with no resale in the window): the last one takes the row. */
  .hdb-keyfacts > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .hdb-street-group {
    display: grid;
    grid-template-columns: minmax(180px, 0.3fr) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
  }

  .page-body .hdb-street {
    margin: 8px 0 0;
  }

  .hdb-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: center;
    gap: 35px 55px;
    padding: 72px 0;
  }

  .page-body > .shell > .hdb-cta:last-child {
    margin-bottom: -80px;
  }

  .hdb-cta + .pd-section {
    padding-top: 80px;
  }

  .hdb-cta::after {
    width: 360px;
    height: 360px;
  }

  .hdb-cta-action {
    grid-column: 2;
    margin: 0;
  }

  .hdb-chart {
    padding: 28px 28px 20px;
  }
}

@media (min-width: 981px) {
  /* www's 0.6fr, 1.2fr, 0.6fr, with the last column as wide as the button's label. */
  .hdb-cta {
    grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.2fr) auto;
  }

  .hdb-cta-action {
    grid-column: auto;
    justify-self: end;
  }
}
