.tram-explorer {
  --tram-line: #b8c2ad;
  --tram-background: #f7f5eb;
  --tram-dark: #1d4236;
  --tram-light: #e7ecdf;
  --tram-accent: #945431;
  margin: 24px auto 30px;
  color: #172f27;
  font-size: 1rem;
}

.tram-explorer [hidden] { display: none !important; }
.tram-heading, .tram-results-heading, .tram-map header, .tram-compare header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
  flex-wrap: wrap;
}
.tram-heading { margin-bottom: 16px; }
.tram-heading h2, .tram-map h3, .tram-results-heading h3, .tram-compare h3 { margin: 0; }
.tram-heading p { margin: 6px 0 0; }
.tram-modes, .tram-map-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.tram-explorer button {
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid #6f8974;
  border-radius: 4px;
  background: #f8f6ed;
  color: #172f27;
  font: inherit;
  cursor: pointer;
}
.tram-explorer button:hover { background: #dce5d5; }
.tram-modes button[aria-pressed="true"], .tram-explorer .tram-pin {
  background: var(--tram-dark);
  color: #fff;
}
.tram-explorer :focus-visible { outline: 2px solid #a34a24; outline-offset: 3px; }
.tram-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  gap: 17px;
  align-items: start;
}
.tram-filters[hidden] + .tram-workspace-main { grid-column: 1 / -1; }
.tram-filters, .tram-map, .tram-map-selection, .tram-compare {
  background: var(--tram-background);
  border: 1px solid var(--tram-line);
  border-radius: 6px;
  padding: 12px;
}
.tram-filters { display: grid; gap: 11px; }
.tram-filters label { display: grid; gap: 5px; font-size: .9rem; }
.tram-filters input[type="search"], .tram-explorer select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid #9aaf97;
  border-radius: 3px;
  padding: 5px 8px;
  color: #172f27;
  background: #fcfbf5;
  font: inherit;
}
.tram-filter-group { border-top: 1px solid #ced5c3; }
.tram-filter-group summary { padding: 8px 0; cursor: pointer; font-weight: 650; }
.tram-filter-group label { margin: 0 0 9px; }
.tram-filters .tram-filter-checkbox { display: flex; align-items: flex-start; }
.tram-map header { margin-bottom: 10px; }
.tram-map-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: clamp(245px, 36vw, 430px);
  border: 1px solid #7d978b;
  border-radius: 4px;
  background: #d4e5e0;
  cursor: grab;
  touch-action: pan-y;
}
.tram-map-stage.is-panning { cursor: grabbing; }
.tram-map-stage canvas, .tram-pins { position: absolute; inset: 0; width: 100%; height: 100%; }
.tram-pins { pointer-events: none; }
.tram-explorer .tram-pin {
  position: absolute;
  z-index: 1;
  display: grid;
  min-width: 25px;
  min-height: 25px;
  place-items: center;
  transform: translate(-50%, -50%);
  padding: 1px 5px;
  border-radius: 999px;
  border: 2px solid #fffef7;
  box-shadow: 0 1px 3px #162b25a0;
  font-size: .8125rem;
  font-weight: 700;
  pointer-events: auto;
}
.tram-explorer .tram-pin.is-single { width: 23px; height: 23px; min-width: 23px; min-height: 23px; }
.tram-explorer .tram-pin.is-picked, .tram-explorer .tram-pin:hover { background: var(--tram-accent); z-index: 2; }
.tram-map-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 14px; }
.tram-map-caption p { margin: 6px 0 0; font-size: .875rem; }
.tram-map-selection { margin: 9px 0 0; }
.tram-map-selection h4 { margin: 0 0 4px; }
.tram-map-selection p { margin: 4px 0; }
.tram-map-selection ul { margin: 5px 0; }
.tram-results-heading { margin: 16px 0 6px; }
.tram-results-heading p { margin: 0; }
.tram-results-heading label { display: flex; align-items: center; gap: 6px; font-size: .875rem; }
.tram-results-heading select { width: auto; }
.tram-data-note { margin: 0 0 9px; font-size: .875rem; color: #425549; }
.tram-table-wrap { overflow: auto; border: 1px solid var(--tram-line); border-radius: 4px; }
.tram-explorer table { width: 100%; border-collapse: collapse; font-size: .875rem; text-align: left; }
.tram-explorer th, .tram-explorer td { padding: 9px 8px; border-bottom: 1px solid #d5dacd; vertical-align: top; }
.tram-explorer thead th { color: #172f27; background: var(--tram-light); white-space: nowrap; }
.tram-explorer tr:nth-child(even) td, .tram-explorer tr:nth-child(even) th[scope="row"] { background: #f4f4eb; }
.tram-explorer th[scope="row"] { min-width: 170px; }
.tram-name { display: flex; align-items: center; gap: 7px; }
.tram-name img { flex: 0 0 54px; aspect-ratio: 54 / 42; object-fit: contain; background: #e8ebe1; }
.tram-explorer th small { display: block; font-size: .8125rem; font-weight: 400; }
.tram-explorer a, .tram-exhibits a, .tram-profile-drawing a, .tram-profile-photo a, .tram-number-history a {
  text-decoration: underline;
  text-underline-offset: .15em;
}
.tram-compare { margin-top: 14px; }
.tram-compare header { margin-bottom: 8px; }
.tram-compare .tram-table-wrap { background: white; }
.tram-exhibits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.tram-exhibits article {
  padding: 13px;
  border: 1px solid #b8c2ad;
  border-radius: 6px;
  background: #f7f5eb;
}
.tram-exhibits h2 { font-size: 1.3rem; margin: 0 0 7px; }
.tram-exhibits ul { padding-inline-start: 1.26rem; margin-block: 0; }
.tram-exhibits li + li { margin-top: 9px; }
.tram-exhibits p { margin: 3px 0 0; font-size: .875rem; line-height: 1.4; }
.tram-profile-photo {
  max-width: 770px;
  margin: 18px auto;
  background: #edf0e6;
  border: 1px solid #b8c2ad;
  border-radius: 5px;
  overflow: hidden;
}
.tram-profile-photo img { display: block; width: 100%; height: auto; max-height: 480px; object-fit: contain; }
.tram-profile-photo figcaption { padding: 10px 12px; font-size: .9375rem; }
.tram-profile-photo small { display: block; margin-top: 4px; font-size: .8125rem; }
.tram-profile-drawing, .tram-number-history { padding: 10px 14px; background: #edf0e6; }
.tram-number-history { margin-block: 12px; }
.tram-number-history h2 { margin: 0; font-size: 1.25rem; }

@media (max-width: 820px) {
  .tram-workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tram-filter-group { padding-top: 1px; }
  .tram-map-stage { height: clamp(265px, 56vw, 390px); }
  .tram-exhibits { grid-template-columns: minmax(0, 1fr); }
}
