/* /advisors/<slug>/ — M&A advisor profiles (scripts/build-advisor-pages.mjs).
   Sits on top of company-profile.css + entity-profile.css (hero, sections,
   TOC, statline) and adds the advisor islands: deal cards with a
   Most recent | Largest switch, the deals-per-year bars, the geography bars
   and the partners grid. Locked deal cards are the marketing teaser.
   Colours are theme tokens only. */

/* The advisor's logo sits on a plain tile; a wordmark (Arma) gets a wide one. */
.hero.is-entity .hero-logo { background: var(--logo-tile-bg); border-color: var(--logo-tile-border); }
.hero.is-entity.adv-hero-wordmark .hero-logo { width: 196px; }
.hero.is-entity.adv-hero-wordmark .hero-logo img { padding: 14px 18px; }
@media (max-width: 560px) {
    .hero.is-entity.adv-hero-wordmark .hero-row { grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
    .hero.is-entity.adv-hero-wordmark .hero-logo { width: 160px; height: 64px; }
}

.adv-stats .hero-statline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.85rem; margin-top: 0; padding-top: 0; border-top: 0; }
.adv-stats .hero-stat-label { white-space: normal; }
@media (max-width: 900px) { .adv-stats .hero-statline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .adv-stats .hero-statline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.adv-prose { max-width: 760px; margin-top: 1.5rem; }
.adv-prose p { margin: 0 0 1em; font-size: 1rem; line-height: 1.6; color: var(--white); opacity: 0.84; }
.adv-prose p:last-child { margin-bottom: 0; }

.adv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.adv-tags li { padding: 4px 10px; border: 1px solid var(--border-tray); border-radius: 999px; background: var(--surface-tray); color: var(--text-light); font-size: 0.78125rem; }

.adv-source { margin: 14px 0 0; font-size: 0.8125rem; color: var(--text-faint); }
.adv-source a { color: inherit; text-underline-offset: 3px; }

/* ---- Deal cards ------------------------------------------------------- */

/* Most recent | Largest are two radios: the checked one shows its grid and
   underlines its tab, with no script. */
.adv-set-input { position: absolute; opacity: 0; pointer-events: none; }
.adv-deals-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 24px; border-bottom: 1px solid var(--border-light); }
.adv-tabs { display: flex; gap: 28px; }
.adv-tabs label { position: relative; padding: 10px 0 12px; color: var(--text-faint); font-size: 0.9375rem; font-weight: 600; cursor: pointer; transition: color .15s ease; }
.adv-tabs label::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; transition: background .15s ease; }
.adv-tabs label:hover { color: var(--white); }
.adv-tabs label:hover::after { background: var(--border-mid); }
#adv-set-recent:checked ~ .adv-deals-head label[for="adv-set-recent"],
#adv-set-largest:checked ~ .adv-deals-head label[for="adv-set-largest"] { color: var(--white); }
#adv-set-recent:checked ~ .adv-deals-head label[for="adv-set-recent"]::after,
#adv-set-largest:checked ~ .adv-deals-head label[for="adv-set-largest"]::after { background: var(--white); }
#adv-set-recent:focus-visible ~ .adv-deals-head label[for="adv-set-recent"],
#adv-set-largest:focus-visible ~ .adv-deals-head label[for="adv-set-largest"] { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
#adv-set-recent:checked ~ .adv-deals-grid:not([data-set="recent"]),
#adv-set-largest:checked ~ .adv-deals-grid:not([data-set="largest"]) { display: none; }
.adv-deals-count { margin: 0 0 12px; color: var(--text-faint); font-size: 0.8125rem; white-space: nowrap; }

.adv-deals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1000px) { .adv-deals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .adv-deals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

/* One island per deal: everything centred inside it, nothing stacked on
   top of it. Logos are cut to transparency at fetch time. */
.adv-deal {
    display: flex; flex-direction: column; align-items: center;
    min-width: 0;
    padding: 28px 20px 22px;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    background: var(--surface-card);
    box-shadow: var(--shadow-md);
    color: inherit;
    text-align: center;
    text-decoration: none;
    transition: box-shadow .2s ease, transform .2s ease;
}
a.adv-deal:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
a.adv-deal:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.adv-deal-logo { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; }
.adv-deal-logo img { display: block; max-width: 76%; max-height: 100%; object-fit: contain; }
.adv-deal-text { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--white); }
.adv-deal-verb { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 18px; margin: 14px 0; color: var(--text-faint); font-size: 0.8125rem; line-height: 1.35; }
.adv-deal-verb svg { width: 13px; height: 13px; flex: none; }
.adv-deal-meta { margin: 20px 0 0; color: var(--text-faint); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.adv-deal-meta b { color: var(--white); font-weight: 600; }

/* Without a wordmark: Dealroom's square logo (or the initial) over the name. */
.adv-deal-party { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.adv-deal-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; overflow: hidden; border: 1px solid var(--logo-tile-border); border-radius: 12px; background: var(--logo-tile-bg); color: var(--text-light); font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.adv-deal-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.adv-deal-name { display: -webkit-box; max-width: 100%; overflow: hidden; color: var(--white); font-size: 0.875rem; font-weight: 600; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.adv-deal-party.is-undisclosed .adv-deal-icon { border-style: dashed; background: transparent; }
.adv-deal-party.is-undisclosed .adv-deal-name { color: var(--text-faint); font-weight: 500; }
.adv-deal.is-locked .adv-deal-icon img { filter: blur(6px) grayscale(1); opacity: 0.5; }
.adv-redaction { display: inline-block; width: 90px; max-width: 100%; height: 10px; vertical-align: middle; border-radius: 999px; background: var(--border-light); }
.adv-deal.is-locked .adv-deal-logo img { filter: blur(14px) grayscale(1); opacity: 0.4; }
.adv-deal.is-locked .adv-deal-verb { color: var(--white); font-weight: 600; }
.adv-locked-icon svg { width: 14px; height: 14px; flex: none; }

@media (max-width: 720px) {
    .adv-deal { padding: 20px 10px 16px; border-radius: 14px; }
    .adv-deal-logo { height: 36px; }
    .adv-deal-logo img { max-width: 84%; }
    .adv-deal-verb { margin: 10px 0; font-size: 0.75rem; }
    .adv-deal-meta { margin-top: 14px; font-size: 0.75rem; }
}

/* The locked note under the grid, with its one action. */
.adv-locked-banner { display: flex; align-items: center; gap: 16px; margin: 36px 0 0; padding: 18px 20px; border: 1px solid var(--border-light); border-radius: 16px; background: var(--surface-card); box-shadow: var(--shadow-sm); }
.adv-locked-icon { display: flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-tray); color: var(--blue); }
.adv-locked-text { min-width: 0; }
.adv-locked-text p { margin: 0; color: var(--text-light); font-size: 0.875rem; line-height: 1.45; }
.adv-locked-text .adv-locked-title { color: var(--white); font-size: 0.9375rem; font-weight: 600; }
.adv-locked-cta { flex: none; margin-left: auto; padding: 10px 18px; border-radius: 10px; background: var(--blue); color: var(--surface-card); font-size: 0.875rem; font-weight: 600; text-decoration: none; transition: background .15s ease; }
.adv-locked-cta:hover { background: var(--blue-hover); }
@media (max-width: 560px) {
    .adv-locked-banner { flex-wrap: wrap; }
    .adv-locked-text { flex: 1 1 0; }
    .adv-locked-cta { flex: 1 1 100%; text-align: center; }
}

/* ---- Deals per year --------------------------------------------------- */

.adv-chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.adv-bars { display: block; width: 100%; min-width: 620px; height: auto; font-family: var(--font-sans); }
.adv-bar.is-sell { fill: var(--blue); }
.adv-bar.is-buy { fill: var(--series-c1); }
.adv-bar.is-capital { fill: var(--series-c2); }
.adv-bars-grid { stroke: var(--chart-grid); }
.adv-bars-axis { stroke: var(--chart-axis); }
.adv-bars-lead { stroke: var(--border-mid); }
.adv-bars-y, .adv-bars-x { fill: var(--text-faint); font-size: 12px; }
.adv-bars-total { fill: var(--white); font-size: 12px; font-weight: 700; }
.adv-bars-lab { fill: var(--white); font-size: 13px; }
.adv-bars-val { font-weight: 700; }

/* ---- Geography -------------------------------------------------------- */

.adv-geo { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 760px) { .adv-geo { grid-template-columns: 1fr; } }
.adv-panel { padding: 18px 20px; background: var(--surface-card); border: 1px solid var(--border-light); border-radius: 14px; box-shadow: var(--shadow-sm); }
.adv-panel h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--white); }
.adv-hbar { display: grid; grid-template-columns: minmax(0, 11em) 1fr 3.4em; align-items: center; gap: 10px; padding: 1.5px 0; font-size: 0.84375rem; color: var(--white); }
.adv-hbar-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.adv-hbar-track { display: block; height: 22px; }
.adv-hbar-track i { display: block; height: 100%; background: var(--blue); }
.adv-hbar-n { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.adv-hbar-n small { font-weight: 400; color: var(--text-faint); font-size: 0.75rem; }

/* Buyer regions: a donut with its labels beside it. */
.adv-donut-wrap { display: flex; align-items: center; gap: 24px; padding-top: 4px; }
.adv-donut { flex: none; width: 168px; height: 168px; }
.adv-donut-seg { fill: none; stroke-width: 26; }
.adv-donut-seg.is-europe, .adv-donut-key i.is-europe { stroke: var(--blue); background: var(--blue); }
.adv-donut-seg.is-na, .adv-donut-key i.is-na { stroke: var(--series-c1); background: var(--series-c1); }
.adv-donut-seg.is-rest, .adv-donut-key i.is-rest { stroke: var(--series-c5); background: var(--series-c5); }
.adv-donut-n { fill: var(--white); font-family: var(--font-display); font-size: 26px; font-weight: 700; text-anchor: middle; }
.adv-donut-l { fill: var(--text-faint); font-size: 10.5px; text-anchor: middle; }
.adv-donut-key { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; list-style: none; }
.adv-donut-key li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 2.6em; align-items: center; gap: 10px; padding: 7px 0; font-size: 0.84375rem; color: var(--white); }
.adv-donut-key li + li { border-top: 1px solid var(--border-light); }
.adv-donut-key i { width: 12px; height: 12px; }
.adv-donut-key span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.adv-donut-key b { font-weight: 700; font-variant-numeric: tabular-nums; }
.adv-donut-key small { color: var(--text-faint); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .adv-donut-wrap { flex-direction: column; align-items: stretch; } .adv-donut { align-self: center; } }

/* ---- Team ------------------------------------------------------------- */

.adv-people { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px 16px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 1000px) { .adv-people { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .adv-people { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 10px; } }
.adv-person { min-width: 0; text-align: center; }
.adv-person-photo { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 112px; aspect-ratio: 1; margin: 0 auto 10px; overflow: hidden; border-radius: 50%; background: var(--logo-tile-bg); border: 1px solid var(--logo-tile-border); color: var(--text-light); font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.adv-person-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.adv-person-name { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--white); line-height: 1.3; }
.adv-person-title { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-faint); line-height: 1.3; }

/* ---- Advisor index ---------------------------------------------------- */

.adv-firms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1000px) { .adv-firms { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .adv-firms { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.adv-firm { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 24px 16px 20px; border: 1px solid var(--border-light); border-radius: 16px; background: var(--surface-card); box-shadow: var(--shadow-md); color: inherit; text-align: center; text-decoration: none; transition: box-shadow .2s ease, transform .2s ease; }
.adv-firm:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.adv-firm:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.adv-firm-logo { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 6px; overflow: hidden; border: 1px solid var(--logo-tile-border); border-radius: 14px; background: var(--logo-tile-bg); color: var(--text-light); font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.adv-firm-logo.is-wordmark { width: 132px; }
.adv-firm-logo img { display: block; width: 100%; height: 100%; padding: 8px; object-fit: contain; }
.adv-firm-name { max-width: 100%; color: var(--white); font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.adv-firm-meta { color: var(--text-faint); font-size: 0.8125rem; }

/* Profiles | League table: the same radio tabs as the deal sets. */
#adv-view-profiles:checked ~ .adv-deals-head label[for="adv-view-profiles"],
#adv-view-league:checked ~ .adv-deals-head label[for="adv-view-league"] { color: var(--white); }
#adv-view-profiles:checked ~ .adv-deals-head label[for="adv-view-profiles"]::after,
#adv-view-league:checked ~ .adv-deals-head label[for="adv-view-league"]::after { background: var(--white); }
#adv-view-profiles:focus-visible ~ .adv-deals-head label[for="adv-view-profiles"],
#adv-view-league:focus-visible ~ .adv-deals-head label[for="adv-view-league"] { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
#adv-view-profiles:checked ~ .adv-view:not([data-view="profiles"]),
#adv-view-league:checked ~ .adv-view:not([data-view="league"]) { display: none; }

/* ---- League table ----------------------------------------------------- */

.adv-league { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.adv-league caption { padding-bottom: 12px; color: var(--text-faint); font-size: 0.8125rem; text-align: left; caption-side: top; }
.adv-league th { padding: 0 12px 10px; border-bottom: 1px solid var(--border-mid); color: var(--text-faint); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.adv-league th button { padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.adv-league th button:hover, .adv-league th[aria-sort] button { color: var(--white); }
.adv-league th[aria-sort] button::after { content: "\00a0↓"; }
.adv-league th button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 3px; }
.adv-league td { padding: 5px 12px; border-bottom: 1px solid var(--border-light); color: var(--white); vertical-align: middle; }
.adv-league th:first-child, .adv-league td:first-child { padding-left: 0; }
.adv-league-rank { width: 2.5em; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.adv-league-firm { display: flex; align-items: center; gap: 10px; color: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; }
.adv-league-firm:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.adv-league-logo { display: flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; overflow: hidden; border: 1px solid var(--logo-tile-border); border-radius: 6px; background: var(--logo-tile-bg); color: var(--text-light); font-family: var(--font-display); font-size: 0.8125rem; font-weight: 700; }
.adv-league-logo.is-wordmark { width: 52px; }
.adv-league-logo img { display: block; width: 100%; height: 100%; padding: 2px; object-fit: contain; }
.adv-league-hq { color: var(--text-light); }
td.adv-league-hq { white-space: nowrap; }
.adv-league-flag { margin-right: 6px; }
/* The three value columns share one shape: a thick, faint bar behind the
   number, both left-aligned. The header lines up with the number. */
.adv-league-num { width: 18%; white-space: nowrap; }
.adv-league td.adv-league-num { padding-left: 16px; }
.adv-league th.adv-league-num { padding-left: 24px; }
.adv-league-cell { position: relative; display: flex; align-items: center; height: 24px; }
.adv-league-bar { position: absolute; top: 0; bottom: 0; left: 0; background: var(--blue); opacity: 0.14; }
.adv-league-num b { position: relative; padding-left: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.adv-league-num small { color: var(--text-faint); font-size: 0.75rem; font-weight: 600; }
.adv-league-none { color: var(--text-faint); }
@media (max-width: 760px) {
    .adv-league-hq, td.adv-league-hq, .adv-league-avg { display: none; }
    .adv-league td, .adv-league th { padding-left: 6px; padding-right: 6px; }
    .adv-league-num { width: auto; }
    .adv-league td.adv-league-num { padding-left: 6px; }
    .adv-league th.adv-league-num { padding-left: 14px; }
    .adv-league-firm, .adv-league th { white-space: normal; }
}

/* Region filter on /advisors/, shown once a second region has three firms. */
.adv-regions { display: flex; gap: 6px; margin: 0 0 10px; }
.adv-regions button { padding: 5px 12px; border: 1px solid var(--border-light); border-radius: 999px; background: var(--surface-card); color: var(--text-light); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.adv-regions button:hover { color: var(--white); }
.adv-regions button[aria-pressed="true"] { border-color: var(--white); background: var(--white); color: var(--surface-card); }
.adv-regions button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.adv-firm[hidden], .adv-league-wrap[hidden] { display: none; }
.adv-regions button, .adv-tabs label { white-space: nowrap; }
@media (max-width: 720px) {
    .adv-deals-head:has(.adv-regions) { flex-wrap: wrap; }
    .adv-regions { order: -1; width: 100%; margin: 0 0 4px; }
}

/* /advisors/ index: the views sit right under the hero, without the section rule. */
section.body-section.adv-index > .body-inner { border-top: 0; padding-top: 0.5rem; }
