/* Homepage model finder (build-model-finder.py writes the markup, model-finder.js filters it).
   A spec sheet, so: ruled table, tabular figures, the site's ink, red and condensed display face. */
.kmi-finder {
  background: #fff;
  border-block: 1px solid rgba(15, 23, 42, 0.14);
  color: #0f172a;
  padding: 4.5rem 0 4rem;
}

.kmi-finder__in {
  margin: 0 auto;
  max-width: 80rem;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .kmi-finder__in { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .kmi-finder__in { padding: 0 2rem; }
}

.kmi-finder__head h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

.kmi-finder__head p {
  color: #334155;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  max-width: 62ch;
}

.kmi-finder__form {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .kmi-finder__form { grid-template-columns: 12rem 12rem 14rem auto; justify-content: start; }
}

.kmi-finder__form label {
  color: #334155;
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kmi-finder__form label:nth-of-type(3) { grid-column: 1 / -1; }

@media (min-width: 768px) {
  .kmi-finder__form label:nth-of-type(3) { grid-column: auto; }
}

.kmi-finder__form label span { color: #c41818; }

.kmi-finder__form input,
.kmi-finder__form select {
  appearance: none;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.35);
  border-radius: 0;
  color: #0f172a;
  font: 600 1.125rem/1.2 var(--font-mono, "Courier New", monospace);
  font-variant-numeric: tabular-nums;
  display: block;
  height: 3rem;
  letter-spacing: 0;
  margin-top: 0.375rem;
  padding: 0 0.875rem;
  text-transform: none;
  width: 100%;
}

.kmi-finder__form select {
  background-image: linear-gradient(45deg, transparent 50%, #0f172a 50%), linear-gradient(135deg, #0f172a 50%, transparent 50%);
  background-position: calc(100% - 1.125rem) 1.3rem, calc(100% - 0.8rem) 1.3rem;
  background-repeat: no-repeat;
  background-size: 0.33rem 0.33rem;
  font-family: inherit;
  font-size: 1rem;
  padding-right: 2.25rem;
}

.kmi-finder__form input::placeholder { color: #64748b; font-weight: 400; }

.kmi-finder__form input:focus-visible,
.kmi-finder__form select:focus-visible,
.kmi-finder__scroll:focus-visible,
.kmi-finder button:focus-visible,
.kmi-finder a:focus-visible {
  outline: 2px solid #c41818;
  outline-offset: 2px;
}

.kmi-finder__reset,
.kmi-finder__more {
  background: none;
  border: 1px solid rgba(15, 23, 42, 0.35);
  color: #0f172a;
  cursor: pointer;
  font: 700 0.8125rem/1 inherit;
  height: 3rem;
  letter-spacing: 0.08em;
  padding: 0 1.25rem;
  text-transform: uppercase;
  transition: background-color 160ms, color 160ms;
}

.kmi-finder__reset { grid-column: 1 / -1; justify-self: start; }

@media (min-width: 768px) {
  .kmi-finder__reset { grid-column: auto; }
}

.kmi-finder__reset:hover,
.kmi-finder__more:hover { background: #0f172a; color: #fff; }

.kmi-finder__count {
  color: #0f172a;
  font: 700 0.8125rem/1 var(--font-mono, "Courier New", monospace);
  letter-spacing: 0.06em;
  margin: 1.75rem 0 0.625rem;
  text-transform: uppercase;
}

.kmi-finder__scroll {
  border: 1px solid rgba(15, 23, 42, 0.35);
  max-width: 60rem; /* four columns: keep each figure near its model name */
  max-height: 31rem; /* no-JS and "all models": the table scrolls inside its frame */
  overflow: auto;
}

.kmi-finder table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  width: 100%;
}

.kmi-finder thead th {
  background: #0f172a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.75rem 0.875rem;
  position: sticky;
  text-align: right;
  text-transform: uppercase;
  top: 0;
  white-space: nowrap;
  z-index: 1;
}

.kmi-finder thead th:first-child { text-align: left; }
.kmi-finder thead th span { color: #fca5a5; }

.kmi-finder tbody tr { border-top: 1px solid rgba(15, 23, 42, 0.14); }
.kmi-finder tbody tr:hover { background: #fdf1f1; }
.kmi-finder tbody tr[hidden] { display: none; }

.kmi-finder tbody th {
  font-weight: 400;
  padding: 0.625rem 0.875rem;
  text-align: left;
}

.kmi-finder tbody th a {
  color: #0f172a;
  font-family: var(--font-barlow, "Barlow Condensed"), "Arial Narrow", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(196, 24, 24, 0.55);
  text-underline-offset: 0.2em;
}

.kmi-finder tbody th a:hover { color: #c41818; }

.kmi-finder tbody th span {
  color: #475569;
  display: block;
  font-size: 0.75rem;
  margin-top: 0.125rem;
}

.kmi-finder tbody td {
  font: 600 1rem/1.3 var(--font-mono, "Courier New", monospace);
  padding: 0.625rem 0.875rem;
  text-align: right;
  white-space: nowrap;
}

.kmi-finder abbr {
  color: #b45309;
  cursor: help;
  font-size: 0.6875rem;
  font-weight: 700;
  text-decoration: none;
}

.kmi-finder__empty {
  border: 1px solid rgba(15, 23, 42, 0.35);
  margin: 0;
  max-width: 60rem;
  padding: 1.5rem 1rem;
}

.kmi-finder__empty a,
.kmi-finder__foot p a { color: #c41818; font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }

.kmi-finder__foot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.kmi-finder__wa {
  align-items: center;
  background: #0f7a6d;
  color: #fff;
  display: inline-flex;
  font-size: 0.8125rem;
  font-weight: 700;
  height: 3rem;
  letter-spacing: 0.08em;
  padding: 0 1.25rem;
  text-transform: uppercase;
  transition: background-color 160ms;
}

.kmi-finder__wa:hover { background: #0b5e55; }

.kmi-finder__foot p {
  color: #475569;
  flex-basis: 100%;
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 0.25rem 0 0;
  max-width: 75ch;
}

@media (max-width: 479px) {
  .kmi-finder { padding: 3.5rem 0 3rem; }
  .kmi-finder thead th, .kmi-finder tbody th, .kmi-finder tbody td { padding-inline: 0.5rem; }
  .kmi-finder tbody td { font-size: 0.875rem; }
  .kmi-finder tbody th a { font-size: 1.125rem; }
}

@media (max-width: 479px) {
  .kmi-finder thead th { font-size: 0.625rem; letter-spacing: 0.04em; padding-inline: 0.375rem; }
  .kmi-finder tbody th, .kmi-finder tbody td { padding-inline: 0.375rem; }
  .kmi-finder tbody th:first-child, .kmi-finder thead th:first-child { padding-left: 0.625rem; }
  .kmi-finder tbody td:last-child, .kmi-finder thead th:last-child { padding-right: 0.625rem; }
}

/* a filtered shortlist (8 rows) shows whole; only the long lists scroll inside the frame */
.kmi-finder__scroll.is-short { max-height: none; }
