/*
  Post-build overrides for dbt-docs (vendored bundle).
  Stock rules use ~300px min width on sidebars; tighten here and retest after dbt upgrades.
*/

/* Overview: QCF logo (~2/3 of prior size — intrinsic 1500px wide; % of column + cap) */
img[src*="qcf-logo"] {
  width: 66.666%;
  max-width: 1000px;
  height: auto;
  display: block;
}

/* Overview / shell layout */
.app-menu,
.app-sidebar {
  width: 14% !important;
  min-width: 180px !important;
}

/* Model & resource IDE layout (tree + content) */
.layout-menu {
  flex: 0 0 18% !important;
  max-width: 200px !important;
  min-width: 160px !important;
}

/*
  Model / source column table (components/column_details in dbt-docs).
  Stock Description td uses max-width:1px + nowrap — we override for wrap.
  Meta badges (column.meta.data_source) are injected by docs/js/dbt-docs-columns.js.
  Column names: auto width with wrapping (no ellipsis). Data tests: minimal width.
*/
.table-responsive table.table-borderless.table-hover {
  table-layout: auto;
  width: 100%;
}

/*
  Column name: wide enough for typical identifiers on one line; wrap only long names
  at word boundaries — never use overflow-wrap:anywhere or width:0 here (causes
  one-letter-per-line stacking).
*/
.table-responsive table.table-borderless.table-hover thead th:nth-child(1),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(1) {
  min-width: 9rem;
  max-width: 24rem;
  width: max-content;
  white-space: normal !important;
  overflow: visible !important;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
  vertical-align: top;
  text-align: left;
}

.table-responsive table.table-borderless.table-hover thead th:nth-child(2),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(2) {
  width: 11%;
  min-width: 6.5rem;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

/*
  Description: wide line length (wider than the “Description” header label alone).
  Column min-width is set on both th/td so the whole column (not just the header) claims space.
*/
.table-responsive table.table-borderless.table-hover thead th:nth-child(3),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(3) {
  min-width: clamp(22rem, 52vw, 56rem) !important;
  width: auto !important;
  max-width: none !important;
  white-space: normal !important;
  overflow-x: visible !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  text-overflow: clip !important;
  vertical-align: top;
}

/* Expanded Details: data_source → badge when mapped; else plain text (see dbt-docs-columns.js) */
td.column-expanded dd.detail-value .dbt-col-meta-badge-img {
  max-height: 1.75rem;
  max-width: 10rem;
  width: auto;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}

/* Markdown image in YAML description (rendered by dbt-docs-columns.js) */
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(3) .dbt-doc-desc-inline-img {
  max-height: 1.5em;
  width: auto;
  vertical-align: middle;
  margin-right: 0.35rem;
  display: inline-block;
}

.table-responsive table.table-borderless.table-hover thead th:nth-child(4),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(4) {
  width: 13%;
  min-width: 5.5rem;
  max-width: 9rem;
  white-space: normal;
}

/* Data tests: compact (boolean letters); header stacks — ~width of “Tests” */
.table-responsive table.table-borderless.table-hover thead th:nth-child(5),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(5) {
  width: 2.85rem;
  min-width: 2.5rem;
  max-width: 3.25rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  line-height: 1.15;
  font-size: 0.65rem;
  word-break: break-word;
}

.table-responsive table.table-borderless.table-hover thead th:nth-child(5) {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.table-responsive table.table-borderless.table-hover thead th:nth-child(6),
.table-responsive table.table-borderless.table-hover tbody tr.column-row > td:nth-child(6) {
  width: 7%;
  min-width: 3.5rem;
  max-width: 5rem;
}
