/*
 * Client Wins pop-up styles. Everything is scoped under .cw-dialog.
 * Match the host site by overriding these variables, e.g.
 *   .cw-dialog { --cw-accent: #0f766e; --cw-font: "Your Site Font", sans-serif; }
 */
.cw-dialog {
  --cw-card: #ffffff;
  --cw-ink: #1b2a3d;
  --cw-muted: #5d6b7b;
  --cw-accent: #1f3a5a;
  --cw-line: #dde3ea;
  --cw-tile: #ffffff;            /* logo tiles stay white in every theme: the logos are made for light backgrounds */
  --cw-tile-line: #e3e8ef;
  --cw-tile-label: #6a7785;
  --cw-backdrop: rgba(15, 23, 36, .55);
  --cw-shadow: rgba(20, 36, 58, .28);
  --cw-focus: #386894;
  --cw-radius: 18px;
  --cw-font: inherit;
}
@media (prefers-color-scheme: dark) {
  .cw-dialog {
    --cw-card: #131e2e; --cw-ink: #e7edf5; --cw-muted: #9eacbd; --cw-accent: #d3e3f5; --cw-line: #26364b;
    --cw-tile-line: #2c3d54; --cw-backdrop: rgba(3, 7, 14, .7); --cw-shadow: rgba(0, 0, 0, .55); --cw-focus: #86b0dc;
  }
}
/* explicit theme switches used by many sites win over the OS setting */
:root[data-theme="light"] .cw-dialog, .light .cw-dialog {
  --cw-card: #ffffff; --cw-ink: #1b2a3d; --cw-muted: #5d6b7b; --cw-accent: #1f3a5a; --cw-line: #dde3ea;
  --cw-tile-line: #e3e8ef; --cw-backdrop: rgba(15, 23, 36, .55); --cw-shadow: rgba(20, 36, 58, .28); --cw-focus: #386894;
}
:root[data-theme="dark"] .cw-dialog, .dark .cw-dialog {
  --cw-card: #131e2e; --cw-ink: #e7edf5; --cw-muted: #9eacbd; --cw-accent: #d3e3f5; --cw-line: #26364b;
  --cw-tile-line: #2c3d54; --cw-backdrop: rgba(3, 7, 14, .7); --cw-shadow: rgba(0, 0, 0, .55); --cw-focus: #86b0dc;
}

.cw-dialog {
  width: min(1000px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--cw-radius);
  background: transparent;
  color: var(--cw-ink);
  font-family: var(--cw-font);
  overflow: visible;
}
.cw-dialog::backdrop { background: var(--cw-backdrop); backdrop-filter: blur(3px); }
.cw-dialog[open] { animation: cw-pop .3s cubic-bezier(.2, .8, .2, 1); }
.cw-dialog[open]::backdrop { animation: cw-fade .25s ease; }
@keyframes cw-pop { from { transform: translateY(10px) scale(.98); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes cw-fade { from { opacity: 0; } to { opacity: 1; } }

.cw-card {
  position: relative;
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--cw-card);
  border-radius: var(--cw-radius);
  box-shadow: 0 30px 80px -24px var(--cw-shadow), 0 2px 8px rgba(0, 0, 0, .08);
  padding: clamp(20px, 4vw, 40px);
  display: grid;
  gap: 26px;
}

.cw-head { display: grid; gap: 8px; padding-right: 44px; }
.cw-eyebrow {
  display: flex; flex-wrap: wrap; gap: 2px .6em;
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--cw-muted);
}
.cw-eyebrow span { white-space: nowrap; }
.cw-eyebrow span + span::before { content: "\00b7"; margin-right: .6em; }
.cw-figure {
  margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 14px; row-gap: 2px;
  font-size: inherit; font-weight: inherit; line-height: 1;
}
.cw-figure b {
  font-weight: 900; font-size: clamp(44px, 7vw, 66px); line-height: 1; letter-spacing: -.015em;
  color: var(--cw-accent); font-variant-numeric: tabular-nums;
}
.cw-figure span { font-size: clamp(17px, 2.3vw, 21px); font-weight: 700; color: var(--cw-ink); }
.cw-intro { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--cw-muted); max-width: 62ch; }

.cw-close {
  position: absolute; top: clamp(12px, 2.4vw, 22px); right: clamp(12px, 2.4vw, 22px);
  width: 38px; height: 38px; padding: 0; border-radius: 50%;
  border: 1px solid var(--cw-line); background: var(--cw-card); color: var(--cw-muted);
  display: grid; place-items: center; cursor: pointer; transition: color .15s, border-color .15s;
}
.cw-close:hover { color: var(--cw-ink); border-color: var(--cw-muted); }
.cw-close svg { width: 16px; height: 16px; }
.cw-close:focus-visible { outline: 3px solid var(--cw-focus); outline-offset: 3px; }

.cw-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
}
.cw-tile {
  min-width: 0; box-sizing: border-box; aspect-ratio: 3 / 2; margin: 0;
  background: var(--cw-tile); border: 1px solid var(--cw-tile-line); border-radius: 12px;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center;
  padding: 14px 12px 10px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cw-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px var(--cw-shadow); }
.cw-tile img { width: var(--cw-w, 80%); max-width: 100%; max-height: 100%; height: auto; object-fit: contain; display: block; }
.cw-tile small {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cw-tile-label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

.cw-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px;
  border-top: 1px solid var(--cw-line); padding-top: 14px; font-size: 13px; color: var(--cw-muted);
}
.cw-foot strong { color: var(--cw-ink); font-weight: 700; }

@media (max-width: 820px) { .cw-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .cw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cw-grid .cw-tile:last-child { grid-column: span 2; aspect-ratio: 3 / 1; }
  .cw-grid .cw-tile:last-child img { width: calc(var(--cw-w, 80%) * .5); }
  .cw-tile small { font-size: 10px; letter-spacing: .05em; white-space: normal; text-align: center; line-height: 1.2; }
  .cw-eyebrow { flex-direction: column; }
  .cw-eyebrow span + span::before { content: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cw-dialog[open], .cw-dialog[open]::backdrop { animation: none; }
  .cw-tile, .cw-tile:hover { transition: none; transform: none; }
}
