/* ADAPT styling for the OpenMetadata sign-in page.
 *
 * The stock page is a two-column pitch: a looping product showcase video fills
 * the left 52% of the window, with the sign-in card in the right 48%. That is
 * marketing for the tool, shown to people who have not signed in yet - the first
 * thing a client sees of this service, and the one page where ADAPT has least
 * reason to advertise someone else's product.
 *
 * So the showcase column goes and the card takes the whole window, leaving a
 * plain sign-in page.
 *
 * Matched by :has(video) rather than by class. Every class on these two columns
 * is a Tailwind utility string generated by OpenMetadata's build
 * (tw:flex-[1_1_52%]), which changes whenever they adjust the layout; the video
 * is the thing that actually identifies the column, and it is the only <video>
 * in the shell.
 *
 * Nothing needs to re-centre the card by hand: the remaining column keeps its
 * own flex-grow, so it expands to fill the row and the card centres within it.
 * Measured at 1600px wide - the card lands at x=548 of a 1600px viewport, which
 * is exactly centred.
 *
 * Where :has() is unsupported the rule does not apply and the stock two-column
 * page renders - the branding is absent rather than broken.
 */
main.ant-layout-content > div:has(video) {
  display: none !important;
}

/* ── The help menu ─────────────────────────────────────────────────────────
 *
 * The whole menu goes, not individual items. Its contents are fixed in the
 * bundle as exactly five entries - tour, doc, api, slack, version - and all
 * five are vendor-facing: a demo tour, OpenMetadata's documentation, its
 * Swagger page, its Slack community, and its release notes. Removing them one
 * by one would leave a button that opens an empty dropdown.
 *
 * The trigger is matched by its data-testid, which OpenMetadata sets on the
 * button itself. Its Ant Design classes are shared with the notification and
 * profile buttons beside it, so a class match would take those too.
 */
[data-testid="help-icon"] {
  display: none !important;
}

/* ── The product tour ──────────────────────────────────────────────────────
 *
 * Demo content, and broken demo content here: the tour walks a mock Shopify
 * table whose identifier is hardcoded in TourPage.component, and this
 * deployment has never ingested OpenMetadata's sample_data service - so
 * reaching it errors with "table instance for ... not found".
 *
 * The help menu above carried one entry point; this is the other, an invitation
 * on the home welcome panel. Matched by href because that is what identifies it
 * and it catches any further link a release adds. The route itself is closed
 * separately, in the tour guard, so a typed URL cannot reach it either.
 */
a[href="/tour"] {
  display: none !important;
}

/* ── The release-notes banner ──────────────────────────────────────────────
 *
 * A floating card reading "Version 2.0.1 - We've just released a new update!"
 * with a link to the vendor's product-updates page. It announces the tool's
 * version to whoever is looking, which is the thing the tab title and the help
 * menu were changed to stop doing, and it is the only external link left in the
 * signed-in UI.
 *
 * Safe to hide outright, unlike the welcome panel it sits over: this is a
 * dismissible overlay, so nothing is behind it that a reader needs. (Hiding the
 * welcome panel WAS tried - it leaves the home page blank but for a stray
 * dismiss cross, because that panel is what home renders until it is dismissed.)
 */
.whats-new-alert-affix {
  display: none !important;
}

/* ── The "Star us on GitHub" popup ─────────────────────────────────────────
 *
 * A card that appears over the landing page asking the reader to go and star
 * the tool's repository. It names the tool, links off to GitHub, and is the
 * clearest example of the product advertising itself to someone who is here to
 * do their own work.
 *
 * Both hooks are used because they are on different elements: the outer card
 * carries the class, the inner one the test id, and hiding only the inner would
 * leave the outer holding its space.
 *
 * Note what this does NOT stop: the component fetches the repository's star
 * count from api.github.com when it decides to render, and hiding it with CSS
 * does not prevent that request. It is invisible to a reader but would show in
 * a network trace. Stopping it means setting the cookie the dismiss button sets,
 * whose name is built from a minified constant in another chunk - not worth
 * chasing for a background request nobody sees.
 */
.github-star-popup-card,
[data-testid="github-star-popup-card"] {
  display: none !important;
}

/* ── Links to the vendor's own sites ───────────────────────────────────────
 *
 * The help menu carried most of these and is gone, but individual pages link
 * out too - the Data Insights page has a "docs" link to
 * docs.open-metadata.org. Matching the domain rather than each link catches the
 * ones a future release adds, which a list of selectors would not.
 *
 * Hidden rather than repointed: there is no ADAPT page to send someone to for
 * "how data insights work". The feature stays; the invitation to read the
 * vendor's manual goes.
 */
a[href*="open-metadata.org"],
a[href*="getcollate.io"] {
  display: none !important;
}

/* ── Connector logos in the Explore tree ───────────────────────────────────
 *
 * The tree groups databases as Databases > connector type > service, and puts
 * the vendor's product logo on both of the middle rows: the SQL Server logo on
 * "mssql" and again on every service under it. The connector-type row cannot be
 * changed from the catalog at all - its icon comes from a list compiled into
 * ServiceIconUtils - and a service's own style.iconURL fixes only the row below
 * it, so this is the one place both are reached.
 *
 * Matched as "an <img> in a tree icon slot" rather than by file name. Only the
 * connector logos are <img> there; every other tree icon (database, schema,
 * table) is an inline SVG. Most of the logos are also inlined into the bundle
 * as data: URIs, so a src match would catch SQL Server but not, say, Redshift.
 *
 * The slot goes rather than just the image, or the title would sit behind an
 * empty 18px gap. Where :has() is unsupported the second rule still hides the
 * image and only the gap remains. A service given a style.iconURL is hidden too:
 * it is rendered through the same <img>.
 */
.explore-tree .ant-tree-iconEle:has(> img) {
  display: none !important;
}

.explore-tree .ant-tree-iconEle > img {
  display: none !important;
}

/* ── Connector logos everywhere else a service is shown ────────────────────
 *
 * The same logo is drawn by three more components, each with its own markup,
 * so the tree rule above reaches none of them:
 *
 *   Settings > Services, grid view, and the home page's Data Assets widget:
 *   a card whose icon slot carries data-testid="service-icon". Scoped to
 *   service-card because the Add Service connector picker reuses the
 *   service-icon test id, and there the logos are how a connector is chosen.
 *
 *   Settings > Services, table view: a bare <img> immediately before the
 *   service-name link, with no hook of its own.
 *
 *   The header of a service page and of every database, schema and table
 *   under it: a round badge holding the logo. Its only identifying classes are
 *   Tailwind utilities, so it is matched by the image class pair, which occurs
 *   once in the header component, and scoped to the header's test id.
 */
[data-testid="service-card"] [data-testid="service-icon"],
div:has(> [data-testid^="service-name-"]) > img,
[data-testid="data-assets-header"] div:has(> img.tw\:size-5.tw\:object-contain) {
  display: none !important;
}

/* ── Internal names beside display names ───────────────────────────────────
 *
 * Where an entity has a display name, OpenMetadata still prints its internal
 * name next to it: a second line under the page title, and the first line of a
 * name cell in list tables. Internal names cannot always follow a rename -
 * services and agents cannot be renamed at all, and a database keeps the name it
 * has on the source server or the next ingestion run recreates it - so a
 * catalogued system can carry an internal name that is not the one it should be
 * known by. The display name is the one that is meant to be read.
 *
 * Each rule applies only when a display name is present. Without one, the same
 * elements carry the title or the only name, and stay.
 *
 *   Service and asset pages (service, database, schema, table...): the
 *   heading and the name line are not siblings - the text component wraps each
 *   in its own tooltip and prose divs - so the rule is scoped to a header that
 *   contains a display-name heading at all. Without a display name that heading
 *   is not rendered and the name element is the title itself.
 *
 *   Service pages: the name element is marked entity-header-display-name only
 *   in the two-line layout, which is the class pairing matched here.
 *
 *   Name cells in list tables (a service's Databases tab, a schema's tables):
 *   the name link comes first, the display name in column-display-name after.
 *
 * The internal name is still in the page URL and in what the copy button copies.
 */
[data-testid="data-assets-header"]:has([data-testid="entity-header-display-name"]) [data-testid="entity-header-name"],
[data-testid="entity-header-name"].entity-header-display-name,
[data-testid="column-name"]:has(> [data-testid="column-display-name"]) > :first-child {
  display: none !important;
}

/* ── Connector logos on asset cards, lineage, search and recently viewed ────
 *
 * Four more components draw the connector's product logo beside an asset, each
 * with its own markup, so none of the rules above reach them:
 *
 *   Asset cards (Explore results, and the Assets tab of a domain, data product
 *   or glossary term): the first breadcrumb, the service, carries the logo as an
 *   <img>. The other crumbs are inline SVGs.
 *
 *   Lineage nodes, on an asset's Lineage tab and the Lineage page: a slot
 *   classed entity-service-icon. The slot goes rather than just the image, or
 *   the name sits behind an empty gap.
 *
 *   The global search suggestions: an <img> leading each result button.
 *
 *   The home page's Recently Viewed tiles: the logo IS the tile's picture, so
 *   hiding it alone leaves a bare word on a coloured square. A generic database
 *   glyph is drawn in its place as a masked pseudo-element - not content:url()
 *   on the <img>, which Firefox ignores and would leave the logo showing.
 *
 * All connectors, not only SQL Server: every catalogued system should look the
 * same, and the -15 rules above already treat the logos that way. Scoped to these
 * components, so the Add Service connector picker keeps its logos.
 */
ol.explore-search-card-breadcrumbs img,
.entity-service-icon:has(> img),
.entity-service-icon > img,
[data-testid="global-search-suggestion-box"] button > img,
[data-testid="recently-viewed-asset"] .entity-icon-container > img {
  display: none !important;
}

[data-testid="recently-viewed-asset"] .entity-icon-container:has(> img)::before {
  content: "";
  width: 32px;
  height: 32px;
  background-color: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M3 5v14a9 3 0 0 0 18 0V5'/%3E%3Cpath d='M3 12a9 3 0 0 0 18 0'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M3 5v14a9 3 0 0 0 18 0V5'/%3E%3Cpath d='M3 12a9 3 0 0 0 18 0'/%3E%3C/svg%3E") center / contain no-repeat;
}
