/* Ashlar Ledger free tools. Loaded on /tools/ pages only, after styles.css. Uses the :root tokens from styles.css. */

.tool-stamp {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.45rem 0.8rem;
  border-left: 3px solid var(--brass);
  background: rgba(255, 255, 255, 0.06);
  color: #e6e2da;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 40rem;
}
.page-hero .tool-stamp { color: #e6e2da; }

/* Layout: form and result, stacked on mobile, side by side on wide screens */
.tool { padding: 2rem 0 1rem; }
.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 62rem) {
  .tool-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2rem; }
  .tool-result { position: sticky; top: calc(var(--header-h) + 1rem); }
}

.tool-card {
  background: var(--paper);
  border: 1px solid var(--mortar);
  border-top: var(--rule) solid var(--brass);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.35rem 1.6rem;
  min-width: 0;
}
.tool-card h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 1.1rem;
  line-height: 1.25;
}

.tool-noscript {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: #F3EBDD;
  border: 1px solid var(--brass);
  color: var(--ink);
  font-size: 0.95rem;
}

/* Form */
.field { margin: 0 0 1.35rem; padding: 0; border: 0; min-width: 0; }
.field > label,
.field > legend {
  display: block;
  padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 0.4rem;
}
.field-hint { margin: 0.35rem 0 0; font-size: 0.86rem; color: var(--slate); line-height: 1.45; }
.field-error {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brick);
}
.field-error[hidden],
.field-hint[hidden] { display: none; }

.input-money { position: relative; display: block; }
.input-money .prefix {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--slate);
  pointer-events: none;
}
.tool input[type="text"],
.tool select {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--slate);
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}
.tool .input-money input[type="text"] { padding-left: 1.9rem; }
.tool input[aria-invalid="true"] { border-color: var(--brick); border-width: 2px; }
.tool input[type="text"]:focus-visible,
.tool select:focus-visible,
.tool input[type="radio"]:focus-visible,
.tool input[type="checkbox"]:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

.choice-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.choice-list.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width: 26rem) { .choice-list.two-col { grid-template-columns: 1fr; } }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--mortar);
  background: var(--portland);
  cursor: pointer;
  min-height: 2.75rem;
}
.choice:hover { border-color: var(--brass); }
.choice:has(input:checked) { border-color: var(--green); background: var(--output); }
.choice input { margin: 0.2rem 0 0; width: 1.15rem; height: 1.15rem; flex: 0 0 auto; accent-color: var(--green); }
.choice span { font-weight: 500; font-size: 0.97rem; line-height: 1.4; color: var(--charcoal); }
.choice.is-disabled { opacity: 0.6; cursor: not-allowed; }

.tool-actions { margin: 0.25rem 0 0; }
.tool-actions .btn { min-height: 3rem; width: 100%; font-size: 1rem; }
@media (min-width: 30rem) { .tool-actions .btn { width: auto; min-width: 14rem; } }

/* Result card */
.tool-result .tool-card { background: var(--paper); }
.result-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-deep);
}
.result-total {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.result-total.result-headline { font-size: clamp(1.55rem, 5vw, 2.1rem); line-height: 1.2; }
.result-rate { margin: 0.5rem 0 0; color: var(--charcoal); }
.result-split { margin: 0.35rem 0 0; color: var(--slate); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.result-empty { margin: 0; color: var(--slate); }
.result-notes {
  margin: 1.1rem 0 0;
  padding: 0.8rem 1rem 0.8rem 1.9rem;
  background: var(--output);
  border-left: 3px solid var(--green);
  font-size: 0.93rem;
  line-height: 1.5;
}
.result-notes li { margin: 0.25rem 0; }
.result-facts { margin: 1.2rem 0 0; padding: 0; }
.result-facts > div {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr);
  gap: 0.2rem 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--mortar);
}
@media (max-width: 30rem) { .result-facts > div { grid-template-columns: 1fr; } }
.result-facts dt { font-weight: 600; color: var(--ink); font-size: 0.93rem; }
.result-facts dd { margin: 0; color: var(--charcoal); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.result-sub { font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink); margin: 1.4rem 0 0.6rem; }
.result-foot { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--slate); }

/* Tables */
.table-scroll {
  margin: 1.2rem 0 0;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.static-tables .table-scroll { margin-top: 0.5rem; }
.band-table {
  width: 100%;
  min-width: 19rem;
  border-collapse: collapse;
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
}
.band-table caption { text-align: left; }
.band-table th,
.band-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--mortar);
  vertical-align: top;
}
.band-table thead th {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  background: transparent;
}
.band-table tbody th { font-weight: 500; color: var(--charcoal); text-align: left; }
.band-table td,
.band-table thead th:not(:first-child),
.band-table tfoot td { text-align: right; }
.band-table.text-cols td { text-align: left; }
.band-table.text-cols thead th { text-align: left; }
.band-table.num-cols td { text-align: right; }
.band-table.num-cols thead th:not(:first-child) { text-align: right; }
.band-table tfoot th,
.band-table tfoot td {
  font-weight: 700;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 0;
}
.band-table tfoot th { text-align: left; }
.band-table .row-ads th,
.band-table .row-ads td { background: var(--portland); }

/* Content below the tool */
.tool-prose h2 { scroll-margin-top: 5.5rem; }
.static-tables h3 { margin-top: 1.6rem; }
.sources-list { padding-left: 1.1rem; }
.sources-list li { overflow-wrap: anywhere; margin: 0.4rem 0; }
.tool-disclaimer {
  margin: 2rem 0 0;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--mortar);
  border-left: var(--rule) solid var(--brass);
  font-size: 0.95rem;
}
.tool-disclaimer p { margin: 0 0 0.6rem; }
.tool-disclaimer ul { margin: 0; }

/* Soft next-step panel */
.tool-next {
  margin: 2.5rem 0 0;
  padding: 1.5rem 1.4rem 1.6rem;
  background: var(--portland);
  border: 1px solid var(--mortar);
  border-top: var(--rule) solid var(--brass);
}
.prose .tool-next h2 { margin-top: 0; font-size: 1.4rem; }
.tool-next p { margin: 0 0 0.8rem; }
.tool-next .btn { margin: 0.2rem 0 0.9rem; }
.tool-next .small-link { font-size: 0.95rem; color: var(--slate); margin: 0; }

/* Index cards: reuse guide-card; add a free marker */
.tool-cards { margin-top: 0.5rem; }
.tool-cards .guide-card h3 { font-size: 1.3rem; }
.tools-intro { max-width: 40rem; }
.section-tools .section-head { margin-bottom: 1.6rem; }

@media (max-width: 40rem) {
  .tool-card { padding: 1.2rem 1rem 1.3rem; }
  .tool { padding-top: 1.25rem; }
}
