/* ==========================================================================
   ADB Rotor Finder
   Shape-first rotor identification: pick a cross-section, then filter on
   dimensions. Reuses the caliper guide shell (.cid-header / .cid-method /
   .cid-body / .cid-cta come from caliper-guide.css, which these pages also
   load) and adds only what the finder itself needs.

   These sit inside the dark .cid-body section, so everything here is themed
   off the site's dark palette variables rather than fixed light-theme colours.
   ========================================================================== */

/* --- Step 1: shape cards ------------------------------------------------- */

.rf-shapes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 8px;
}

.rf-shape {
  display: block;
  text-decoration: none;
  color: var(--white, #fff);
  background: var(--dark-mid, #2C2C2A);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 8px;
  padding: 26px 20px 20px;
  text-align: center;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  min-width: 0;
}

.rf-shape:hover,
.rf-shape:focus-visible {
  border-color: var(--red, #D85A30);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
  transform: translateY(-2px);
}

.rf-shape-fig {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

/* A photo, when one is dropped into /images/adb-rotor-finder/, replaces the
   drawn cross-section via the same onerror swap the caliper guide uses. */
.rf-shape-fig img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 4px;
}

.rf-shape-fig img.hidden { display: none; }
.rf-shape-fig .rf-svg    { display: none; }
.rf-shape-fig .rf-svg.visible { display: block; }

/* On a shape page the figure is the only illustration and has the width to
   itself, so it runs larger than the three-across cards on the index. */
.rf-shape-fig-lg {
  height: 280px;
  justify-content: flex-start;
  margin: 4px 0 18px;
}

.rf-shape-fig-lg img { max-height: 280px; }
.rf-shape-fig-lg .rf-svg { width: 300px; height: 232px; }

@media (max-width: 700px) {
  .rf-shape-fig-lg { height: 200px; }
  .rf-shape-fig-lg img { max-height: 200px; }
  .rf-shape-fig-lg .rf-svg { width: 220px; height: 170px; }
}

.rf-shape-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--white, #fff);
  margin-bottom: 6px;
}

.rf-shape-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary, rgba(255, 255, 255, .72));
  margin-bottom: 14px;
  min-height: 42px;
}

.rf-shape-count {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--red, #D85A30);
  border-top: 1px solid var(--border, rgba(255, 255, 255, .09));
  padding-top: 12px;
  width: 100%;
}

/* --- Step 2: filter bar -------------------------------------------------- */

.rf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--dark-mid, #2C2C2A);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 22px;
}

.rf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 165px;
}

.rf-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, .5));
}

.rf-field select,
.rf-field input {
  font: inherit;
  font-size: 14px;
  padding: 9px 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 5px;
  background: #1a1a18;
  color: var(--white, #fff);
  min-width: 0;
  width: 100%;
}

.rf-field input::placeholder { color: rgba(255, 255, 255, .38); }

/* The dropdown list itself is painted by the OS, which does not inherit the
   dark field colours — set both so the options stay readable. */
.rf-field select option { background: #1a1a18; color: #fff; }

.rf-field select:focus,
.rf-field input:focus {
  outline: none;
  border-color: var(--red, #D85A30);
  box-shadow: 0 0 0 3px rgba(216, 90, 48, .22);
}

.rf-clear {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary, rgba(255, 255, 255, .72));
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.rf-clear:hover {
  border-color: var(--red, #D85A30);
  color: var(--white, #fff);
}

.rf-count {
  font-size: 14px;
  color: var(--text-secondary, rgba(255, 255, 255, .72));
  margin-bottom: 12px;
}

.rf-count strong { color: var(--white, #fff); }

/* --- Step 2: results table ----------------------------------------------- */

.rf-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 8px;
}

.rf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rf-table th {
  background: #1a1a18;
  color: var(--white, #fff);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
}

/* Dimensions read badly when they wrap ("16 5/16" split over two lines), so
   cells hold their line and the wrapper scrolls instead. Application text is
   free prose and is allowed to wrap — see .rf-app. */
.rf-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, .09));
  color: var(--text-secondary, rgba(255, 255, 255, .72));
  vertical-align: top;
  white-space: nowrap;
}

.rf-table tbody tr:hover { background: rgba(255, 255, 255, .035); }

.rf-pn {
  font-weight: 700;
  color: var(--red, #D85A30);
  text-decoration: none;
  white-space: nowrap;
}

.rf-pn:hover { text-decoration: underline; }

.rf-dash { color: var(--text-muted, rgba(255, 255, 255, .5)); }

/* Secondary metric reading under an imperial dimension. */
.rf-mm {
  display: block;
  font-size: 12px;
  color: var(--text-muted, rgba(255, 255, 255, .5));
  margin-top: 2px;
}

.rf-app {
  font-size: 13px;
  min-width: 170px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rf-empty { white-space: normal; }

.rf-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary, rgba(255, 255, 255, .72));
  font-size: 15px;
}

.rf-empty a { color: var(--red, #D85A30); }

.rf-note {
  font-size: 12.5px;
  color: var(--text-muted, rgba(255, 255, 255, .5));
  line-height: 1.6;
  margin-top: 14px;
  max-width: 860px;
}

.rf-note a { color: var(--red, #D85A30); }

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

@media (max-width: 900px) {
  .rf-shapes { grid-template-columns: 1fr; gap: 18px; }
  .rf-shape-fig { height: 130px; }
  .rf-shape-desc { min-height: 0; }
}

@media (max-width: 700px) {
  .rf-table { min-width: 720px; }
  .rf-filters { padding: 14px; gap: 12px; }
  .rf-field { flex: 1 1 140px; }
  .rf-clear { width: 100%; }
}
