/* DitchBook free tools — shared styles for /tools/** pages.
   Builds on ../styles.css tokens; does not redefine .btn / .btn-primary /
   .btn-secondary or the color/type variables. Load alongside /styles.css. */

.breadcrumb {
  font-size: var(--step--1);
  color: var(--ink-soft);
  margin: 1.75rem 0 0;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  padding: 0;
  margin: 0;
  max-width: none;
}

.breadcrumb li {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  color: var(--water-deep);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--ink-mid);
}

/* ---------- Intro / hero block ---------- */

.tool-article {
  padding: clamp(2.25rem, 3vw, 3.5rem) 0 var(--space-section);
}

.tool-kicker {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--water-deep);
  font-weight: 600;
  margin: 1.25rem 0 0.75em;
}

.tool-article h1 {
  max-width: 26ch;
  margin-bottom: 0.5em;
}

.tool-dek {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-mid);
  max-width: 52ch;
  margin: 0 0 1.5rem;
  border-left: 2px solid var(--water);
  padding-left: 1.15rem;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--water-deep);
  background: var(--water-tint);
  border: 1px solid var(--water-line);
  border-radius: 5px;
  padding: 0.6em 1em;
  margin: 0 0 2.25rem;
  max-width: fit-content;
}

.privacy-note::before {
  content: "\1F512";
  font-size: 0.95em;
}

/* ---------- Tool index page ---------- */

.tool-index-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
  border-top: 1px solid var(--border);
}

.tool-index-list li {
  margin: 0;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}

.tool-index-list h2 {
  font-size: var(--step-1);
  margin-bottom: 0.35em;
}

.tool-index-list p {
  color: var(--ink-mid);
  margin-bottom: 0.6em;
}

.tool-index-list a.tool-link {
  font-weight: 600;
  text-decoration: none;
}

.tool-index-list a.tool-link:hover,
.tool-index-list a.tool-link:focus {
  text-decoration: underline;
}

/* ---------- Section scaffolding ---------- */

.tool-section {
  margin: 0 0 clamp(2.25rem, 4vw, 3rem);
  padding-bottom: clamp(2.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tool-section h2 {
  font-size: var(--step-2);
  margin-bottom: 0.3em;
}

.tool-section-note {
  color: var(--ink-mid);
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}

.tool-card {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--paper-dim);
  padding: clamp(1.25rem, 3vw, 2rem);
  max-width: none;
}

.tool-card + .tool-card {
  margin-top: 1.5rem;
}

/* ---------- Forms ---------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.field label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--ink-mid);
}

.field .hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 400;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  padding: 0.6em 0.75em;
  width: 100%;
  line-height: 1.3;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2.5px solid var(--water);
  outline-offset: 1px;
  border-color: var(--water);
}

textarea {
  min-height: 9rem;
  font-family: var(--font-sans);
  resize: vertical;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.btn-small {
  font-size: 0.85rem;
  padding: 0.55em 1.1em;
}

button.btn {
  cursor: pointer;
  font: inherit;
  font-family: var(--font-sans);
  font-weight: 600;
}

button.btn-secondary {
  background: transparent;
}

.remove-row {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3em 0.5em;
}

.remove-row:hover {
  color: var(--water-deep);
}

/* ---------- Result readouts ---------- */

.result-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-strong);
}

.result-item .result-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 0.25em;
}

.result-item .result-value {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--water-deep);
  font-variant-numeric: tabular-nums;
}

.result-item.result-total .result-value {
  font-size: var(--step-2);
}

/* ---------- Tables (billing roll) ---------- */

.table-scroll {
  /* position: relative so this is the containing block for any
     position:absolute descendant (e.g. styles.css's .visually-hidden
     table-header spans) — otherwise such a descendant escapes this
     container's overflow-x clipping and widens the whole page. */
  position: relative;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

table.calc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 30rem;
  background: var(--paper);
}

table.calc-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  padding: 0.9rem 1rem 0;
  font-family: var(--font-serif);
}

table.calc-table th,
table.calc-table td {
  padding: 0.65em 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: var(--step--1);
  white-space: nowrap;
}

table.calc-table th {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink-mid);
  background: var(--paper-dim);
}

table.calc-table td.num,
table.calc-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.calc-table tfoot td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid var(--border-strong);
}

/* ---------- Individual notices ---------- */

.notices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.notice-card {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--paper);
  padding: 1.5rem;
  max-width: none;
}

.notice-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.9rem;
}

.notice-head .notice-company {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-0);
}

.notice-head .notice-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.notice-body dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4em 1.25em;
  margin: 0 0 1rem;
}

.notice-body dt {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.notice-body dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.notice-amount {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--step-2);
  color: var(--water-deep);
  margin: 0.5rem 0;
}

.notice-payline {
  font-size: var(--step--1);
  color: var(--ink-mid);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.notice-actions {
  margin-top: 1rem;
}

/* ---------- Utility ---------- */

.no-print-inline {
  display: inline;
}

.is-empty-message {
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .tool-article {
    padding-top: 0;
  }

  .breadcrumb,
  .privacy-note {
    display: none;
  }

  .tool-card,
  .notice-card {
    border-color: #999;
    background: #fff;
    box-shadow: none;
  }

  .table-scroll {
    border-color: #999;
    overflow: visible;
  }

  table.calc-table th {
    background: #fff;
  }

  /* Print-mode targeting: which output block is visible on paper is
     controlled by a data attribute the print buttons set on <body>. */
  body[data-print-mode="roll"] .notices-output,
  body[data-print-mode="notices"] .roll-output,
  body[data-print-mode="single-notice"] .roll-output {
    display: none !important;
  }

  body[data-print-mode="single-notice"] .notice-card {
    display: none !important;
  }

  body[data-print-mode="single-notice"] .notice-card.print-target {
    display: block !important;
    break-inside: avoid;
  }

  body[data-print-mode="notices"] .notice-card {
    break-inside: avoid;
    break-after: page;
  }

  body[data-print-mode="notices"] .notice-card:last-child {
    break-after: auto;
  }

  .notices-grid {
    display: block;
  }

  .notices-grid .notice-card + .notice-card {
    margin-top: 1.5rem;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 520px) {
  .notice-head {
    flex-direction: column;
    gap: 0.25rem;
  }

  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
}
