/* ==========================================================================
   /broker-directory/ — method, filters, responsive comparison table, glossary
   Table follows modern-web-guidance "responsive-table": semantic table in a focusable
   labelled region; container query switches to stacked rows with injected labels.
   ========================================================================== */

/* ---------- Method ---------- */
.bd-method__grid { display: grid; gap: 2.5rem; }
.bd-method__head { margin-block-end: 0; }
@media (min-width: 64rem) { .bd-method__grid { grid-template-columns: 5fr 7fr; gap: 5rem; align-items: start; } }
.bd-method__steps { list-style: none; margin: 0; padding: 0; display: grid; border-block-start: 1px solid var(--line-light); }
.bd-method__steps li {
  display: grid; grid-template-columns: 3rem 1fr; gap: .3rem 1rem; padding-block: 1.5rem; border-block-end: 1px solid var(--line-light);
}
.bd-method__num { grid-row: span 2; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; color: var(--gold-deep); }
.bd-method__steps h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.4rem, 1.25rem + .5vw, 1.65rem); line-height: 1.15; }
.bd-method__steps p { color: var(--text-muted); font-size: var(--fs-sm); max-width: 36rem; }

/* ---------- Directory head ---------- */
.bd-directory__head { display: grid; gap: 1rem; margin-block-end: 2rem; }
.bd-directory__head .section-head { margin-block-end: 0; }
.bd-directory__note { color: var(--text-muted); font-size: var(--fs-sm); max-width: 30rem; }
@media (min-width: 64rem) { .bd-directory__head { grid-template-columns: 1fr auto; align-items: end; gap: 4rem; margin-block-end: 3rem; } }

/* ---------- Filters ---------- */
.bd-filters {
  display: grid; gap: 1rem; padding: 1.25rem; margin-block-end: 1.25rem;
  background: var(--ivory); border: 1px solid var(--line-light); border-radius: var(--radius);
}
@media (min-width: 48rem) { .bd-filters { grid-template-columns: 1fr 1fr; padding: 1.5rem; } .bd-field--search { grid-column: 1 / -1; } }
@media (min-width: 64rem) { .bd-filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: end; } .bd-field--search { grid-column: auto; } }
.bd-field { display: grid; gap: .4rem; min-inline-size: 0; }
.bd-field label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.bd-field__control { position: relative; }
.bd-field input, .bd-field select {
  inline-size: 100%; min-block-size: 3rem; padding: .7rem 1rem; background: var(--paper);
  border: 1px solid var(--sand); border-radius: var(--radius); font-size: 1rem; color: var(--text);
  transition: border-color .3s, box-shadow .3s;
}
.bd-field input { padding-inline-start: 2.75rem; }
.bd-field input::placeholder { color: #8A90A0; }
.bd-field input::-webkit-search-cancel-button { cursor: pointer; }
.bd-field__icon { position: absolute; inset-inline-start: 1rem; inset-block-start: 50%; translate: 0 -50%; color: var(--gold-deep); pointer-events: none; }
.bd-field select {
  appearance: none; padding-inline-end: 2.75rem; text-overflow: ellipsis; cursor: pointer;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C5A1C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 1rem center / 16px no-repeat;
}
.bd-field input:focus-visible, .bd-field select:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 163, 92, .25); }
.bd-filters__actions { display: flex; align-items: center; gap: 1rem; min-block-size: 3rem; }
.bd-filters__actions:not(:has(> :not([hidden]))) { display: none; }
.bd-filters__apply { min-block-size: 3rem; }
.bd-filters__reset { font-size: var(--fs-sm); font-weight: 600; color: var(--gold-deep); text-underline-offset: .25em; padding-block: .75rem; white-space: nowrap; }

.bd-count { font-size: var(--fs-sm); color: var(--text-muted); margin-block-end: 1rem; letter-spacing: .02em; }
.bd-count strong { color: var(--text); font-weight: 700; }

/* ---------- Table ---------- */
.bd-table-wrap { overflow-x: auto; max-inline-size: 100%; container-type: inline-size; border-radius: var(--radius); }
.bd-table-wrap:focus-visible { outline-offset: 4px; }
.bd-table { inline-size: 100%; border-collapse: separate; border-spacing: 0; text-align: start; }
.bd-table thead th {
  padding: 0 1.25rem 1rem 0; text-align: start; vertical-align: bottom;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted);
  border-block-end: 1px solid var(--text);
}
.bd-table tbody > tr > * { padding: 1.6rem 1.25rem 1.6rem 0; text-align: start; vertical-align: middle; border-block-end: 1px solid var(--line-light); }
.bd-table tbody tr { transition: background-color .4s var(--ease-out); }
@media (hover: hover) { .bd-table tbody tr:hover { background: linear-gradient(90deg, rgba(201, 163, 92, .07), transparent 80%); } }
.bd-table thead th:first-child { inline-size: 40%; }

/* Broker cell */
.bd-broker { display: grid; grid-template-columns: 2.25rem 1fr; align-items: baseline; gap: .5rem; font-weight: inherit; }
.bd-broker__index { font-family: var(--font-display); font-size: 1rem; color: var(--gold-deep); }
.bd-broker__link { display: grid; gap: .2rem; justify-items: start; text-decoration: none; color: var(--text); }
.bd-broker__name {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.6rem, 1.4rem + .6vw, 1.9rem); line-height: 1.1;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .6s var(--ease-out);
}
.bd-broker__host { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-xs); letter-spacing: .06em; color: var(--text-muted); }
.bd-broker__host .icon { color: var(--gold-deep); transition: translate .4s var(--ease-out); }
@media (hover: hover) {
  .bd-broker__link:hover .bd-broker__name { background-size: 100% 1px; }
  .bd-broker__link:hover .bd-broker__host .icon { translate: 2px -2px; }
}

/* Regulator chips (each links to the official register) */
.bd-regs, .bd-plats { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; margin: 0; padding: 0; }
.bd-reg {
  display: inline-grid; place-items: center; min-block-size: 2.25rem; min-inline-size: 3.5rem; padding: .25rem .75rem;
  border: 1px solid var(--gold); border-radius: 999px; text-decoration: none;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; color: var(--gold-deep);
  transition: background-color .35s var(--ease-out), color .35s var(--ease-out);
}
.bd-reg abbr { text-decoration: none; cursor: inherit; }
@media (hover: hover) { a.bd-reg:hover { background: var(--ink); border-color: var(--ink); color: var(--gold-soft); } }
.bd-plats li {
  display: inline-flex; align-items: center; min-block-size: 2rem; padding: .2rem .7rem;
  font-size: var(--fs-sm); color: var(--text); background: rgba(22, 27, 43, .045); border-radius: 2px;
}
@media (pointer: coarse) { .bd-reg { min-block-size: 2.75rem; min-inline-size: 3.75rem; } }

/* Stacked layout when the table's own container is narrow. */
@container (width < 44rem) {
  .bd-table, .bd-table thead, .bd-table tbody, .bd-table tr, .bd-table th, .bd-table td { display: block; }
  .bd-table thead { display: none; }
  .bd-table tbody { display: grid; gap: .75rem; }
  .bd-table tbody tr[hidden] { display: none; }
  .bd-table tbody tr {
    position: relative; background: var(--ivory); border: 1px solid var(--line-light); border-radius: var(--radius); padding: 1.25rem 1.25rem .5rem;
  }
  .bd-table tbody tr::before { content: ""; position: absolute; inset: -1px -1px auto; block-size: 2px; background: var(--gold); border-radius: var(--radius) var(--radius) 0 0; opacity: .8; }
  .bd-table tbody > tr > * { padding: 0; border: 0; }
  .bd-broker { grid-template-columns: 1fr auto; padding-block-end: 1rem !important; border-block-end: 1px solid var(--line-light) !important; }
  .bd-broker__index { order: 2; }
  .bd-table td { display: grid; gap: .6rem; padding-block: 1rem !important; }
  .bd-table td + td { border-block-start: 1px solid var(--line-light) !important; }
  .bd-table td::before {
    content: attr(data-label); font-size: .6875rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); line-height: 1.4;
  }
}

/* Empty state */
.bd-empty {
  display: grid; justify-items: center; gap: .75rem; text-align: center; padding: 2.5rem 1.25rem;
  border: 1px dashed var(--sand); border-radius: var(--radius); margin-block-start: .5rem; color: var(--text-muted);
}
.bd-empty svg { color: var(--gold); }
.bd-empty strong { display: block; color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; margin-block-end: .25rem; }

.bd-disclaimer { margin-block-start: 2rem; max-width: 56rem; line-height: 1.7; }
.bd-disclaimer strong { color: var(--text); letter-spacing: .02em; }

/* ---------- Glossary ---------- */
.bd-glossary__head { margin-block-end: 0; }
.bd-gloss { border-block-start: 1px solid var(--line-light); }
.bd-gloss__row { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding-block: 1.25rem; border-block-end: 1px solid var(--line-light); align-items: baseline; }
.bd-gloss dt { font-family: var(--font-display); font-size: 1.75rem; line-height: 1; font-weight: 600; color: var(--gold-deep); }
.bd-gloss dt abbr { text-decoration: none; }
.bd-gloss dd { display: grid; gap: .35rem; justify-items: start; }
.bd-gloss__name { font-size: var(--fs-md); color: var(--text); line-height: 1.4; }
.bd-gloss .link-arrow { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; }
@media (min-width: 48rem) {
  .bd-gloss__row { grid-template-columns: 7rem 1fr auto; align-items: center; }
  .bd-gloss dd { display: contents; }
}

/* ---------- For brokerages ---------- */
.bd-brokerages__grid { display: grid; gap: 2.5rem; }
.bd-brokerages__head { margin-block-end: 0; }
@media (min-width: 64rem) { .bd-brokerages__grid { grid-template-columns: 5fr 7fr; gap: 5rem; align-items: center; } }
.bd-related { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--line-light); }
.bd-related a {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k icon" "t icon"; gap: .2rem 1rem; align-items: center;
  padding-block: 1.25rem; border-block-end: 1px solid var(--line-light); text-decoration: none; color: inherit;
}
.bd-related__k { grid-area: k; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }
.bd-related__t { grid-area: t; font-family: var(--font-display); font-size: clamp(1.3rem, 1.15rem + .5vw, 1.6rem); line-height: 1.2; }
.bd-related .icon { grid-area: icon; color: var(--gold-deep); transition: translate .4s var(--ease-out); }
@media (min-width: 48rem) { .bd-related a { grid-template-columns: 7rem 1fr auto; grid-template-areas: "k t icon"; } }
@media (hover: hover) { .bd-related a:hover .icon { translate: 4px 0; } .bd-related a:hover .bd-related__t { color: var(--gold-deep); } }
