/* Property tax and escrow estimator.
 *
 * Loaded only by /guides/property-tax-and-escrow/. Kept out of site.css so
 * publishing this guide cannot alter any existing page.
 *
 * Every colour resolves through an existing custom property in site.css.
 * No hex, rgb, or hsl literal appears below.
 *
 * The markup this styles is generated by the shared builder at
 * ../../../website-rescue/tools/tax-engine/build-calculator-pages.py. A class
 * removed here without a look at that template silently unstyles the page.
 */

.calc-form {
  margin: 2rem 0 0;
  padding: 1.75rem;
  background: var(--pale-grey);
  border: 1px solid var(--line);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 1.25rem;
  margin: 0;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.calc-field label {
  font-family: var(--subheading-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
}

.calc-hint {
  font-family: var(--body-font);
  font-weight: 400;
  text-transform: none;
  color: var(--charcoal);
  opacity: 0.7;
}

.calc-field input,
.calc-field select {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--deep-grey);
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  width: 100%;
}

.calc-field input:focus-visible,
.calc-field select:focus-visible,
.calc-checks input:focus-visible {
  outline: 2px solid var(--electric-blue);
  outline-offset: 2px;
}

.calc-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 1.25rem 0 1.25rem;
}

.calc-checks label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--charcoal);
}

/* Validation errors.
 *
 * Marked by weight, a rule, and a leading glyph as well as colour, so the state
 * survives a monochrome display and does not depend on colour perception --
 * WCAG 1.4.1. The rule uses --deep-red, which is already in the palette; no new
 * colour is invented for this page.
 */
.calc-error {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--deep-grey);
  border-left: 3px solid var(--deep-red);
  padding-left: 0.6rem;
  margin-top: 0.15rem;
}

.calc-error::before {
  content: "! ";
  font-weight: 700;
}

/* `hidden` is a UA rule, and any author `display` outranks it at equal
 * specificity. Without this the empty error elements paint on first load as a
 * red rule and a bare "!" under every optional field -- the page opens looking
 * as though the visitor has already got three things wrong. */
.calc-error[hidden],
.calc-scope-error[hidden] {
  display: none;
}

.calc-field input[aria-invalid="true"],
.calc-field select[aria-invalid="true"] {
  border-width: 2px;
  border-color: var(--deep-red);
}

/* An address the table cannot price. It is an alert rather than a field error
 * because nothing the reader typed is wrong -- the calculator's coverage ends
 * there. It is focusable so a keyboard user is sent straight to the reason. */
.calc-scope-error {
  font-weight: 600;
  color: var(--deep-grey);
  background: var(--pale-grey);
  border-left: 3px solid var(--deep-red);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.25rem;
  max-width: 68ch;
}

.calc-scope-error:focus-visible,
.calc-result:focus-visible {
  outline: 2px solid var(--electric-blue);
  outline-offset: 3px;
}

/* Announced, not shown. Carries the headline figure and every validation
 * failure to a screen reader at the moment the form is submitted. */
.calc-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The two homestead questions are grouped so the reader sees them as one
 * decision made twice, for two different owners, rather than one setting. */
.calc-fieldset {
  margin: 1.25rem 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--white);
}

.calc-fieldset legend {
  padding: 0 0.5rem;
  font-family: var(--subheading-font);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--charcoal);
}

.calc-legend-note {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--charcoal);
}

/* The absence of a comparison is rendered as a sentence, not as a zero, so it
 * needs to read as content rather than as fine print. */
.calc-note {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--charcoal);
  border-left: 3px solid var(--electric-blue);
  padding-left: 0.9rem;
  margin: 0 0 2rem;
  max-width: 68ch;
}

.calc-provenance,
.calc-disclaimer {
  font-size: 0.85rem;
  color: var(--charcoal);
  opacity: 0.8;
  margin: 1.5rem 0 0.5rem;
}

.calc-disclaimer {
  line-height: 1.6;
  max-width: 68ch;
}

.calc-result {
  margin-top: 2.5rem;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 2rem;
  border: 1px solid var(--line);
}

.calc-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  color: var(--charcoal);
  opacity: 0.8;
  padding-bottom: 0.5rem;
}

.calc-table th,
.calc-table td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.calc-table thead th {
  font-family: var(--subheading-font);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--charcoal);
}

.calc-table tbody th {
  font-weight: 500;
  color: var(--deep-grey);
}

.calc-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--deep-grey);
}

.calc-table tr:last-child th,
.calc-table tr:last-child td {
  border-bottom: 0;
}

/* The estimated annual tax, and the change against a bill the reader actually
 * supplied, are the figures the guide exists to surface. */
.calc-row-emphasis th,
.calc-row-emphasis td {
  border-top: 2px solid var(--electric-blue);
  border-bottom: 2px solid var(--electric-blue);
  font-weight: 700;
}

@media (max-width: 30rem) {
  .calc-table-breakdown {
    display: block;
    overflow-x: auto;
  }
}
