.tree-library, .tree-packs, .tree-cad {
  width: min(100%, 1240px);
  margin: auto;
  padding: 36px 24px 56px;
  --tree-paper: #f2f1eb;
}
.tree-head { border-top: 1px solid var(--hair); padding-top: 26px; }
.tree-head h2, .tree-packs h2, .tree-cad h2 { margin: 0 0 12px; font-size: 28px; font-weight: 400; }
.tree-head p, .tree-packs > p, .tree-cad > p {
  max-width: 74ch;
  color: var(--cream-2);
  line-height: 1.65;
}
.tree-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-block: 20px 12px; }
.tree-controls[hidden], .tree-card[hidden] { display: none; }
.tree-controls label { min-width: 0; flex: 0 1 245px; font: 12px/1.5 var(--mono); }
.tree-controls select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  color: var(--cream);
  background: #17181c;
  border: 1px solid #626369;
  border-radius: 0;
}
.tree-controls select, .tree-controls button, .tree-close { min-height: 44px; font: 12px/1.5 var(--mono); }
.tree-controls button, .tree-close {
  padding: 8px 12px;
  border: 1px solid #626369;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
}
.tree-count, .tree-meta {
  margin: 0 0 12px;
  color: var(--cream-2);
  font: 11px/1.55 var(--mono);
}
.tree-grid, .tree-cad-grid, .tree-pack-grid { display: grid; gap: 14px; }
.tree-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tree-cad-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tree-pack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tree-card {
  align-self: start;
  min-width: 0;
  border: 1px solid var(--hair);
}
.tree-card summary { display: block; cursor: pointer; list-style: none; }
.tree-card summary::-webkit-details-marker { display: none; }
.tree-card summary:hover .tree-name { color: var(--mint); }
.tree-image, .tree-vector {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 1.1;
  padding: 13px;
  overflow: hidden;
  background: var(--tree-paper, #f2f1eb);
}
.tree-vector { background: #f2f1eb; aspect-ratio: 1.3; }
.tree-image img, .tree-vector svg { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.tree-vector svg { display: block; max-height: 215px; }
.tree-card-label { display: block; padding: 11px 12px; }
.tree-name { display: flex; gap: 6px; justify-content: space-between; color: var(--cream); }
.tree-name::after {
  content: '+';
  color: var(--mint);
  font-family: var(--mono);
}
.tree-card[open] .tree-name::after { content: '−'; }
.tree-card-label .tree-meta { display: block; margin: 3px 0 0; }
.tree-downloads {
  padding: 12px;
  border-top: 1px solid var(--hair);
  color: var(--cream-2);
  font: 14px/1.5 var(--sans);
}
.tree-downloads p { margin: 0 0 12px; }
.tree-format-row {
  display: grid;
  grid-template-columns: 1fr 88px 88px;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.tree-card > .tree-downloads .tree-format-row { grid-template-columns: 1fr 1fr; }
.tree-card > .tree-downloads .tree-format-row span { grid-column: 1 / -1; }
.tree-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tree-format-row a, .tree-links a, .tree-pack-grid a, .tree-cad-zip {
  display: flex;
  align-items: center;
  padding: 7px 9px;
  min-height: 44px;
  border: 1px solid #626369;
  color: var(--cream);
  text-decoration: none;
  font: 12px/1.4 var(--mono);
}
.tree-format-row a:hover, .tree-links a:hover, .tree-pack-grid a:hover, .tree-cad-zip:hover {
  color: var(--mint);
  border-color: var(--mint);
}
.tree-pack-grid a { display: grid; padding: 14px; gap: 3px; }
.tree-pack-grid small { color: var(--cream-2); }
.tree-cad-zip { display: inline-flex; margin: 4px 0 16px; }
.tree-cad h3 { margin: 22px 0 12px; font-size: 21px; font-weight: 400; scroll-margin-top: 20px; }
.tree-cad-grid + h3 { margin-top: 36px; }
.tree-dialog {
  width: min(700px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  overflow: auto;
  background: var(--ink);
  color: var(--cream);
  border: 1px solid #626369;
}
.tree-dialog::backdrop { background: #000b; }
.tree-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.tree-dialog h2 { margin: 0; font-size: 24px; font-weight: 400; }
.tree-dialog .tree-downloads { padding: 0; border: 0; }
.tree-dialog-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.24fr); align-items: start; gap: 16px; }
.tree-dialog-body .tree-image { aspect-ratio: .9; }
.dark-tree-paper .tree-library, .dark-tree-paper .tree-dialog { --tree-paper: #25292a; }
.tree-scale { margin: 26px 0; }
.tree-scale img { display: block; width: 100%; height: auto; background: #faf9f6; }
.tree-scale figcaption { margin-top: 8px; color: var(--cream-2); font: 12px/1.65 var(--mono); }

@media (max-width: 990px) {
  .tree-grid, .tree-cad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 690px) {
  .tree-grid, .tree-cad-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tree-pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .tree-library, .tree-packs, .tree-cad { padding: 24px 20px 40px; }
  .tree-controls label { flex: 1 1 calc(50% - 12px); }
  .tree-controls button { flex: 1 0 100%; }
  .tree-grid, .tree-cad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .tree-card-label { padding-inline: 8px; }
  .tree-dialog { padding: 14px; }
  .tree-dialog-body { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tree-dialog-body .tree-image { height: 148px; aspect-ratio: auto; padding: 9px; }
  .tree-dialog-body .tree-image img { max-height: 130px; }
}
