/* LAPIDAR — free tools (/tools/). Loaded after style.css; everything here is scoped under .t-*
   Same rules as the rest of the site: amber is a light source, brick marks a discrepancy. */

.t-tool { margin-top: clamp(36px, 4vw, 56px); padding-bottom: clamp(40px, 4.4vw, 64px); border-bottom: 1px solid var(--rule); }
.t-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(32px, 4.4vw, 64px); align-items: start; }
.t-grid-wide { grid-template-columns: minmax(0, 1fr); }

/* ---------- Form ---------- */
.t-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.t-form fieldset + fieldset { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--rule-2); }
.t-form legend { padding: 0; margin-bottom: 14px; font-family: var(--serif); font-size: 17px; font-variant-caps: all-small-caps; letter-spacing: .06em; line-height: 1.4; color: var(--amber); }
.t-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 28px; }
.t-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.t-f { display: block; min-width: 0; }
.t-l { display: block; color: var(--muted); font-size: 16.5px; line-height: 1.35; margin-bottom: 4px; }
.t-in { display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid rgba(239, 231, 217, .38); transition: border-color 200ms var(--ease); }
.t-in:focus-within { border-bottom-color: var(--amber); box-shadow: 0 1px 0 0 var(--amber); }
.t-in input, .t-in select {
  flex: 1 1 auto; min-width: 0; width: 100%;
  font: 400 19px/1.3 var(--mono); font-variant-numeric: tabular-nums lining-nums;
  color: var(--paper); background: transparent; border: 0; border-radius: 0;
  padding: 10px 0 9px; caret-color: var(--amber); color-scheme: dark;
}
.t-in input:focus, .t-in select:focus { outline: none; }
.t-in input::placeholder { color: var(--faint); font-style: italic; opacity: 1; font-family: var(--serif); }
.t-in select { appearance: none; -webkit-appearance: none; cursor: pointer; font-family: var(--serif); font-size: 18px; }
.t-in select option { background: var(--ink-2); color: var(--paper); }
.t-aff { flex: none; font: 400 17px/1 var(--mono); color: var(--faint); }
.t-in-sel::after { content: ""; flex: none; width: 7px; height: 7px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: translateY(-4px) rotate(45deg); margin-right: 4px; pointer-events: none; }
.t-hint { margin-top: 6px; font-size: 15.5px; line-height: 1.45; font-style: italic; color: var(--muted); }
.t-err { margin-top: 6px; font-size: 15.5px; line-height: 1.45; color: var(--brick); }
.t-err:empty { display: none; }
.t-f[data-invalid] .t-in { border-bottom-color: var(--brick); box-shadow: 0 1px 0 0 var(--brick); }

/* segmented choice: real radios, styled labels */
.t-seg { display: flex; flex-wrap: wrap; border: 1px solid var(--rule); }
.t-seg label { position: relative; flex: 1 1 auto; }
.t-seg label + label { border-left: 1px solid var(--rule); }
.t-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.t-seg span { display: block; padding: 12px 16px 11px; text-align: center; font-size: 17.5px; line-height: 1.3; color: var(--text); }
.t-seg input:checked + span { background: var(--ink-3); color: var(--paper); box-shadow: inset 0 -2px 0 var(--amber); }
.t-seg input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: -2px; }
@media (hover: hover) { .t-seg label:hover span { color: var(--paper); } }

.t-check { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; line-height: 1.45; color: var(--text); cursor: pointer; }
.t-check input { flex: none; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--amber); }

.t-area {
  display: block; width: 100%; min-height: 270px; resize: vertical;
  font: 400 15px/1.55 var(--mono); font-variant-numeric: tabular-nums lining-nums;
  color: var(--paper); background: var(--ink-2); border: 1px solid var(--rule); border-radius: 0;
  padding: 12px 14px; caret-color: var(--amber); tab-size: 16;
}
.t-area:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.t-area::placeholder { color: var(--faint); }

.t-actions { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.t-btn-q { font: 400 17px/1 var(--serif); color: var(--paper); background: transparent; border: 1px solid var(--rule); border-radius: 2px; padding: 13px 18px 12px; cursor: pointer; }
@media (hover: hover) { .t-btn-q:hover { border-color: var(--amber-dim); color: var(--amber); } }
.t-btn-q:disabled { opacity: .45; cursor: default; }

/* ---------- Result ---------- */
.t-out { position: sticky; top: 24px; min-width: 0; }
.t-out .tape { grid-column: auto; max-width: none; margin: 0; }
.t-out .tape dd.neg { color: var(--paper); }
.t-out .tape .short dd.bad { color: var(--brick); border-bottom-color: var(--brick); }
.t-live { margin-top: 18px; font-size: 18px; line-height: 1.5; color: var(--text); text-wrap: pretty; }
.t-live b { font-weight: 500; color: var(--paper); }
.t-live .bad { color: var(--brick); }
.t-live .ok { color: var(--amber); }

.t-cmp { width: 100%; border-collapse: collapse; font: 400 16px/1.4 var(--mono); font-variant-numeric: tabular-nums lining-nums; color: var(--paper); }
.t-cmp th, .t-cmp td { padding: 12px 0; border-bottom: 1px solid var(--rule-2); text-align: right; vertical-align: baseline; white-space: nowrap; }
.t-cmp thead th { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; padding-top: 14px; }
.t-cmp tbody th { text-align: left; font: 400 17.5px/1.35 var(--serif); color: var(--text); white-space: normal; padding-right: 12px; }
.t-cmp td + td, .t-cmp th + th { padding-left: 16px; }
.t-cmp tr.t-key td { color: var(--amber); font-size: 19px; font-weight: 500; }
.t-cmp tr.t-key th { color: var(--paper); font-style: italic; }
.t-cmp tr:last-child th, .t-cmp tr:last-child td { border-bottom: 0; }

.t-note { margin-top: 22px; padding-left: 18px; border-left: 1px solid var(--amber-dim); font-size: 16.5px; line-height: 1.55; font-style: italic; color: var(--muted); text-wrap: pretty; }
.t-note strong { font-style: normal; font-weight: 500; color: var(--text); }
.t-private { display: flex; gap: 10px; align-items: baseline; margin-top: 14px; font-size: 16.5px; line-height: 1.5; color: var(--muted); }
.t-private::before { content: ""; flex: none; width: 12px; height: 1px; background: var(--amber); transform: translateY(-5px); }

/* ---------- Variance table ---------- */
.t-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.t-sum { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 36px; }
.t-sum > div { padding: 16px 14px 14px 0; }
.t-sum > div + div { padding-left: 14px; border-left: 1px solid var(--rule-2); }
.t-sum dt { font-size: 15.5px; line-height: 1.3; color: var(--muted); }
.t-sum dd { margin-top: 4px; font: 400 26px/1.15 var(--mono); font-variant-numeric: tabular-nums lining-nums; color: var(--paper); }
.t-sum dd small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.t-sum .hot dd { color: var(--brick); }
.t-sum .warm dd { color: var(--amber); }
.t-totals { margin-top: 14px; font: 400 14.5px/1.6 var(--mono); font-variant-numeric: tabular-nums lining-nums; color: var(--muted); }
.t-totals b { font-weight: 400; color: var(--paper); }
.t-res { margin-top: 26px; }
.t-res table td.r { white-space: normal; }
.t-res tr[data-s] td:last-child { font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; }
.t-res tr[data-s="missing"] td:last-child, .t-res tr[data-s="dup"] td:last-child { color: var(--brick); }
.t-res tr[data-s="under"] td:last-child, .t-res tr[data-s="over"] td:last-child { color: var(--amber); }
.t-res tr[data-s="extra"] td:last-child { color: var(--text); }
.t-res tr[data-s="ok"] td { color: var(--muted); }
.t-res tr[data-s="ok"] td:first-child { color: var(--muted); }
.t-res .why { display: block; margin-top: 2px; font: italic 400 15px/1.4 var(--serif); letter-spacing: 0; text-transform: none; color: var(--muted); }
.t-skipped { margin-top: 14px; font-size: 16px; line-height: 1.5; font-style: italic; color: var(--brick); }
.t-skipped:empty { display: none; }

/* ---------- Index ---------- */
.t-list li { grid-template-columns: 72px minmax(0, 1fr); }

@media (max-width: 1000px) {
  .t-grid { grid-template-columns: minmax(0, 1fr); }
  .t-out { position: static; margin-top: 44px; max-width: 640px; }
  .t-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .t-sum > div:nth-child(4) { border-left: 0; padding-left: 0; }
  .t-sum > div:nth-child(n+4) { border-top: 1px solid var(--rule-2); }
}
@media (max-width: 720px) {
  .t-row, .t-row-3, .t-pair { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .t-out { margin-top: 36px; }
  .t-seg span { padding: 12px 10px 11px; font-size: 16.5px; }
  .t-cmp { font-size: 14.5px; }
  .t-cmp tbody th { font-size: 16.5px; }
  .t-cmp tr.t-key td { font-size: 16.5px; }
  .t-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-sum > div:nth-child(n) { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule-2); }
  .t-sum > div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--rule-2); }
  .t-sum > div:nth-child(-n+2) { border-top: 0; }
  .t-sum dd { font-size: 22px; }
  .t-actions { flex-direction: column; align-items: stretch; }
  .t-actions .btn, .t-btn-q { width: 100%; text-align: center; }
  .t-area { min-height: 180px; font-size: 14px; }
}
