/*
 * Connectors page — layered on top of styles.css, which owns the design
 * tokens (:root), the body background, .page, .hero, .btn and .footer. Only
 * what the connectors page adds lives here, so the two pages cannot drift
 * apart on colour or type.
 *
 * One rule here is load-bearing: .tile-mark carries a LIGHT chip background
 * regardless of theme. Vendor logos are a mix of dark-on-transparent,
 * white-on-transparent and opaque JPEGs; a light chip is the only backdrop on
 * which all three stay legible, and it is why a near-black mark (PubMatic's
 * wordmark, Magnite's M) does not disappear against the dark page.
 */

.page-wide {
  max-width: 1120px;
}

.wordmark-link {
  display: inline-block;
  text-decoration: none;
}

.wordmark-link:hover {
  color: var(--accent-hi);
}

.hero .tagline {
  max-width: 62ch;
  margin: 0 auto;
}

/* --- the three promises ------------------------------------------------- */

.promises {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 44px;
}

.promise {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.promise h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--accent-hi);
}

.promise p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-muted);
}

@media (max-width: 820px) {
  .promises {
    grid-template-columns: 1fr;
  }
}

/* --- search -------------------------------------------------------------- */

.controls {
  margin-bottom: 32px;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--fg-muted);
  pointer-events: none;
}

.search {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  font-size: 14.5px;
  font-family: inherit;
}

.search::placeholder {
  color: var(--fg-muted);
}

.search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* --- category sections + tiles ------------------------------------------ */

.cat {
  margin-bottom: 40px;
}

.cat-head {
  margin-bottom: 16px;
}

.cat-head h2 {
  margin: 0 0 3px;
  font-size: 17px;
}

.cat-blurb {
  margin: 0;
  font-size: 13.5px;
  color: var(--fg-muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.tile:hover {
  border-color: var(--accent);
  background: var(--bg-card-hi);
  transform: translateY(-2px);
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile[hidden] {
  display: none;
}

/* The mark: a light chip that both the logo and the monogram sit inside. The
   monogram is the resting state; .has-logo is only added once an image has
   actually decoded, so a 404 or a blocked request degrades silently. */
.tile-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  background: #f4f6fa;
  overflow: hidden;
  flex: 0 0 auto;
}

.tile-mono {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent-brand, #5b8cff);
  text-transform: uppercase;
}

.tile-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 9px;
  opacity: 0;
}

/* Some vendors publish only a wide wordmark (Pontiac at ~3.2:1, PubMatic
   similar). object-fit would letterbox one of those into a few pixels of
   height inside the square safe area, so the mark itself goes wide instead.
   Tiles centre their mark, so a wider pill on two of them still lines up. */
.tile-mark.fit-wide {
  width: 96px;
}

.tile-mark.fit-wide .tile-logo {
  padding: 7px 9px;
}

.tile-mark.has-logo .tile-logo {
  opacity: 1;
}

.tile-mark.has-logo .tile-mono {
  visibility: hidden;
}

.tile-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}

.tile-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-soon {
  color: var(--fg-muted);
  background: rgba(154, 161, 178, 0.1);
  border-color: var(--border);
}

.empty {
  text-align: center;
  color: var(--fg-muted);
  font-size: 14px;
  padding: 24px 0 8px;
}

/* --- dialog -------------------------------------------------------------- */

.detail {
  width: min(680px, calc(100vw - 32px));
  max-height: min(86vh, 860px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--fg);
  overflow: hidden;
}

.detail::backdrop {
  background: rgba(5, 7, 12, 0.72);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-hi);
  color: var(--fg-muted);
  cursor: pointer;
}

.detail-close:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.detail-close svg {
  width: 15px;
  height: 15px;
}

.detail-body {
  max-height: min(86vh, 860px);
  overflow-y: auto;
  padding: 26px 28px 30px;
  overscroll-behavior: contain;
}

.d-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-right: 40px;
  margin-bottom: 22px;
}

.d-mark {
  width: 60px;
  height: 60px;
  border-radius: 14px;
}

.d-mark .tile-mono {
  font-size: 16px;
}

.d-head-text h2 {
  margin: 0 0 5px;
  font-size: 21px;
}

.d-summary {
  margin: 0 0 9px;
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.d-section {
  margin-bottom: 24px;
}

.d-section > h3 {
  margin: 0 0 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-hi);
}

.detail ul,
.detail ol {
  margin: 0;
  padding-left: 20px;
}

.detail li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 7px;
}

.detail li:last-child {
  margin-bottom: 0;
}

.d-can li::marker {
  color: #5bd99a;
}

.d-limits li::marker {
  color: #ffc46b;
}

.d-limits li {
  color: var(--fg-muted);
}

.d-limits strong {
  color: var(--fg);
}

.d-intro {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-muted);
}

.d-option {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--bg);
}

.d-option.is-recommended {
  border-color: rgba(91, 140, 255, 0.5);
  background: var(--bg-card-hi);
}

.d-option-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.d-option-label {
  font-size: 15px;
  font-weight: 700;
}

.d-rec,
.d-alt {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

.d-rec {
  color: var(--accent-hi);
  background: rgba(91, 140, 255, 0.14);
}

.d-alt {
  color: var(--fg-muted);
  background: rgba(154, 161, 178, 0.1);
}

.d-option-lead {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.d-steps li {
  padding-left: 2px;
}

.d-or {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 10px 0;
}

.d-note {
  margin-top: 14px;
  padding: 13px 15px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--bg-card-hi);
}

.d-note strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.d-note p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.detail code {
  font-size: 0.88em;
  padding: 1.5px 5px;
  border-radius: 5px;
  background: rgba(154, 161, 178, 0.16);
  word-break: break-word;
}

.detail a {
  color: var(--accent-hi);
  word-break: break-word;
}

/* --- CTA ----------------------------------------------------------------- */

.cta {
  text-align: center;
  margin: 8px 0 56px;
  padding: 30px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.cta h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.cta p {
  margin: 0 auto 20px;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-muted);
}

.cta-btn {
  display: inline-flex;
  width: auto;
  justify-content: center;
}

@media (max-width: 520px) {
  .tiles {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .detail-body {
    padding: 22px 18px 26px;
  }

  .d-head {
    gap: 12px;
  }
}

.footer a {
  color: var(--accent-hi);
}

/* The page is dark by design (same as index.html), so a light-scheme viewer
   still gets the dark palette — declaring it keeps form controls and the
   dialog backdrop from rendering in the UA's light defaults. */
:root {
  color-scheme: dark;
}
