/*
 * Primer 2026 design tokens for code components.
 *
 * Code components render inside a shadow root. CSS custom properties inherit
 * through it, so each token reads the matching Webflow variable from the
 * "Primer 2026" collection and falls back to the same literal value. That way
 * a component looks right both on the Webflow page and in the local playground.
 *
 * Fluid type and spacing are literal clamp() values: the Webflow API rejected
 * clamp() for size variables, so the p26-* classes in Webflow use these same
 * values directly. Keep both in sync.
 */
:host,
.p26-root {
  /* Color: aliases of existing brand variables */
  --p26-text-strong: var(--_primer-2026---color--text--strong, #20292c);
  --p26-text-default: var(--_primer-2026---color--text--default, #475a61);
  --p26-text-inverse: var(--_primer-2026---color--text--inverse, #ffffff);
  --p26-surface-base: var(--_primer-2026---color--surface--base, #ffffff);
  --p26-surface-subtle: var(--_primer-2026---color--surface--subtle, #f3f5f6);
  --p26-surface-hover: var(--_primer-2026---color--surface--hover, #f7f9fa);
  --p26-surface-inverse: var(--_primer-2026---color--surface--inverse, #262155);
  --p26-border: var(--_primer-2026---color--border--default, rgba(138, 159, 169, 0.32));
  --p26-accent: var(--_primer-2026---color--accent--primary, #6e37ff);
  --p26-accent-strong: var(--_primer-2026---color--accent--strong, #3c327b);
  --p26-accent-soft: var(--_primer-2026---color--accent--soft, #a8a6ff);
  --p26-accent-blue: var(--_primer-2026---color--accent--blue, #3366ff);
  --p26-highlight: var(--_primer-2026---color--highlight, #ffd966);
  --p26-focus: var(--_primer-2026---color--focus-ring, #0b89fd);

  /* Type */
  --p26-font-display: var(--_primer-2026---font--display, EightiesComeback), Georgia, serif;
  --p26-font-body: var(--_primer-2026---font--body, Rubik), Arial, sans-serif;
  --p26-type-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  --p26-type-body-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --p26-type-body: var(--_primer-2026---type--body, 1rem);
  --p26-type-small: var(--_primer-2026---type--small, 0.875rem);

  /* Space and shape */
  --p26-space-2xs: var(--_primer-2026---space--2xs, 0.25rem);
  --p26-space-xs: var(--_primer-2026---space--xs, 0.5rem);
  --p26-space-sm: var(--_primer-2026---space--sm, 1rem);
  --p26-space-md: var(--_primer-2026---space--md, 1.5rem);
  --p26-space-lg: clamp(2rem, 1.6rem + 1.6vw, 3rem);
  --p26-radius-sm: var(--_primer-2026---radius--sm, 8px);
  --p26-radius-md: var(--_primer-2026---radius--md, 12px);
  --p26-radius-lg: var(--_primer-2026---radius--lg, 20px);

  /* Motion */
  --p26-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --p26-duration-fast: 160ms;
  --p26-duration-base: 320ms;
}

/*
 * Primer app UI for homepage demos. Values from the Figma app frames:
 * Rubik 14/20 body (1em here), UI/900 #20292C, UI/700 #475A61, UI/300 #8A9FA9,
 * borders rgba(138,159,169,.32), panel heads #FAFAFA, Blue/50 #F5F7FF,
 * Blue/300 #99B2FF, Blue/800 #3366FF, Blue/850 #2F55CD, Green/500 #1C8C67.
 * Everything is in em so the whole UI scales with the demo's base size.
 */
.p26-demo {
  --ui-900: #20292c;
  --ui-700: #475a61;
  --ui-300: #8a9fa9;
  --ui-line: rgba(138, 159, 169, 0.32);
  --ui-line-soft: rgba(138, 159, 169, 0.19);
  --ui-head: #fafafa;
  --ui-50: #f3f5f6;
  --blue-50: #f5f7ff;
  --blue-100: #ebefff;
  --blue-200: #d6e4ff;
  --blue-300: #99b2ff;
  --blue-800: #3366ff;
  --blue-850: #2f55cd;
  --green-100: #dcfaeb;
  --green-500: #1c8c67;
  --green-600: #219b78;
  --violet: #7a63e0;
  --orange: #ffaa45;
  --red-100: #fde8e8;
  --red-600: #c9372c;
  --ui-shadow: 0 1px 2px rgba(32, 41, 44, 0.06), 0 12px 32px -12px rgba(38, 33, 85, 0.22);

  container-type: inline-size;
  position: relative;
  width: 100%;
  font-family: var(--p26-font-body, Rubik), Arial, sans-serif;
  color: var(--ui-900);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

/* The stage crops its panels like a window into the product. */
.p26-demo__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  font-size: clamp(10px, 2.25cqw, 13px);
  line-height: 1.43;
}

.p26-demo__layer {
  position: absolute;
  will-change: transform, opacity;
}

.p26-demo p {
  margin: 0;
}

/* Panels (collapsible sections in the app) */
.ui-panel {
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
  background: #fff;
  box-shadow: var(--ui-shadow);
}

.ui-panel__head {
  display: flex;
  align-items: center;
  gap: 0.571em;
  height: 2.571em;
  padding: 0 0.571em 0 1.143em;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-head);
  font-weight: 500;
}

.ui-panel__caret {
  color: var(--ui-700);
  font-size: 0.857em;
}

.ui-panel__body {
  padding: 1em 1.143em;
}

/* Chat */
.ui-chat {
  display: flex;
  flex-direction: column;
  gap: 0.857em;
  padding: 1em;
  border: 1px solid var(--ui-line);
  border-radius: 0.857em;
  background: var(--ui-head);
  box-shadow: var(--ui-shadow);
}

.ui-user {
  align-self: flex-end;
  max-width: 88%;
  padding: 0.857em;
  border-radius: 0.571em;
  background: var(--ui-line-soft);
  text-align: right;
}

.ui-assistant {
  padding-right: 2.286em;
}

.ui-steps {
  display: flex;
  flex-direction: column;
  gap: 0.286em;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ui-300);
}

.ui-step {
  display: flex;
  align-items: center;
  gap: 0.286em;
}

.ui-artifact {
  display: flex;
  align-items: center;
  gap: 0.571em;
  padding: 0.857em 1.143em;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
  background: #fff;
}

.ui-artifact.is-highlighted {
  border-color: var(--blue-300);
  background: var(--blue-50);
}

.ui-artifact__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 3.429em;
  height: 3.429em;
  border-radius: 0.571em;
  background: var(--blue-100);
  color: var(--blue-850);
  font-size: 1em;
}

.ui-artifact__icon svg {
  font-size: 1.43em;
}

.ui-artifact__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.ui-artifact__text strong {
  font-size: 1.143em;
  font-weight: 500;
}

.ui-artifact__text span {
  color: var(--ui-300);
}

.ui-button {
  flex: none;
  padding: 0.143em 1.143em;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
  background: #fff;
  box-shadow: inset 0 -1px 2px rgba(32, 41, 44, 0.24);
  color: var(--ui-700);
}

/* Tags, badges, labels */
.ui-tag {
  display: inline-flex;
  padding: 0.286em;
  border: 1px solid var(--ui-line);
  border-radius: 0.286em;
  background: var(--ui-50);
  white-space: nowrap;
}

.ui-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.143em;
}

.ui-badge {
  display: inline-flex;
  padding: 0.143em 0.357em;
  border: 1px solid rgba(28, 140, 103, 0.3);
  border-radius: 0.286em;
  background: var(--green-100);
  color: var(--green-500);
  font-size: 0.857em;
  line-height: 1.33;
  white-space: nowrap;
}

.ui-label {
  display: flex;
  align-items: center;
  gap: 0.286em;
  font-size: 0.857em;
  font-weight: 500;
  letter-spacing: 0.025em;
  line-height: 1.33;
  text-transform: uppercase;
}

.ui-label svg {
  color: var(--ui-300);
  font-size: 1.33em;
}

/* Channel logos keep the Figma SVG proportions inside a 1.43em box. */
.ui-logo {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.43em;
  height: 1.43em;
}

.ui-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Destinations */
.ui-dests {
  display: flex;
  flex-direction: column;
  gap: 0.286em;
}

.ui-dest {
  display: flex;
  align-items: center;
  gap: 0.571em;
  padding: 0.429em 0.571em;
  border: 1px solid var(--ui-line-soft);
  border-radius: 0.286em;
  color: var(--ui-700);
}

.ui-dest.is-checked {
  border-color: var(--blue-300);
  background: var(--blue-50);
}

.ui-dest__name {
  flex: 1;
}

.ui-dest__tag {
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: #efedff;
  color: #5a3da9;
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1.5;
}

.ui-dest__box {
  position: relative;
  display: grid;
  width: 1.143em;
  height: 1.143em;
  font-size: 1.143em;
}

.ui-dest__box svg {
  grid-area: 1 / 1;
}

.ui-dest__on {
  color: var(--blue-800);
  opacity: 0;
}

.ui-dest.is-checked .ui-dest__on {
  opacity: 1;
}

.ui-dest.is-checked .ui-dest__off {
  opacity: 0;
}

/* Filter criteria */
.ui-criteria {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ui-criteria li {
  line-height: 1.43;
}

.ui-criteria b {
  font-weight: 500;
}

.ui-criteria .op {
  color: var(--ui-300);
}

.ui-criteria i {
  font-style: italic;
}

.ui-criteria .join {
  color: var(--ui-300);
  font-weight: 500;
}

.ui-criteria .nested {
  padding-left: 2.6em;
}

/* Distribution bars */
.ui-bars {
  display: flex;
  flex-direction: column;
  gap: 0.143em;
  padding: 0.286em;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
}

.ui-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 4em 2.6em 0.5em;
  align-items: center;
  gap: 0.286em;
  height: 2.286em;
  padding: 0 0.143em 0 0.43em;
  color: var(--ui-700);
}

.ui-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 0.286em 0 0 0.286em;
  background: rgba(51, 102, 255, 0.1);
  transform-origin: left center;
}

.ui-bar > span:not(.ui-bar__fill) {
  position: relative;
}

.ui-bar__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-bar__share,
.ui-bar__rate {
  text-align: right;
}

.ui-conf {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.143em;
}

.ui-conf i {
  width: 0.214em;
  height: 0.214em;
  background: var(--ui-line);
}

.ui-conf.is-high i { background: #25ae80; }
.ui-conf.is-medium i:nth-child(-n + 2) { background: #4da6ff; }
.ui-conf.is-low i:first-child { background: var(--orange); }

/* Metrics */
.ui-metric {
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.571em;
  min-width: 0;
  padding: 0.857em 1.143em;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
  background: #fff;
  white-space: nowrap;
}

.ui-metric strong {
  display: block;
  font-size: 1.286em;
  font-weight: 500;
  line-height: 1.33;
}

.ui-metric__detail {
  display: flex;
  flex-direction: column;
  gap: 0.43em;
  padding: 0.2em 0;
  color: var(--ui-300);
  font-size: 0.714em;
  line-height: 1.2;
}

.ui-metric__detail b {
  color: var(--ui-900);
  font-size: 1.2em;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .p26-demo__layer {
    will-change: auto;
  }
}

/* Screen-reader-only text (descriptions). Each code component renders in its
   own shadow root, so this must live in every component's stylesheet. */
.p26-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/*
 * Improve demo layout. Default styles are the FINISHED composition:
 * report with highlighted rows and flag, recommendations in front.
 */
.imp-chat {
  left: 4%;
  top: 6%;
  width: 62%;
  opacity: 0;
  visibility: hidden;
}

.imp-report {
  left: 3%;
  top: 4%;
  width: 58%;
  display: flex;
  flex-direction: column;
  gap: 1em;
  padding: 1.143em;
  border-radius: 0.857em;
}

/* Report header echoes the Figma "Paid Impact" report typography. */
.imp-report__head {
  display: flex;
  flex-direction: column;
  gap: 0.143em;
  padding-left: 0.857em;
  border-left: 0.3em solid var(--violet);
}

.imp-report__eyebrow {
  color: var(--violet);
  font-size: 0.857em;
  font-weight: 500;
}

.imp-report__title {
  font-size: 1.43em;
  font-weight: 500;
  line-height: 1.2;
}

.imp-report__meta {
  color: var(--ui-700);
  font-size: 0.857em;
}

.imp-kpis {
  display: flex;
  gap: 0.571em;
}

.imp-kpis .ui-metric {
  padding: 0.714em 0.857em;
}

.imp-mix {
  display: flex;
  flex-direction: column;
  gap: 0.43em;
}

.imp-mix__bar {
  display: flex;
  gap: 2px;
  height: 0.571em;
  overflow: hidden;
  border-radius: 999px;
}

.imp-mix__seg {
  display: block;
  transform-origin: left center;
}

.imp-mix__seg.is-linkedin,
.imp-mix__legend i.is-linkedin { background: #0a66c2; }
.imp-mix__seg.is-meta,
.imp-mix__legend i.is-meta { background: #3366ff; }
.imp-mix__seg.is-google,
.imp-mix__legend i.is-google { background: #fbbc04; }

.imp-mix__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 1em;
  color: var(--ui-700);
  font-size: 0.857em;
}

.imp-mix__legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}

.imp-mix__legend i {
  width: 0.6em;
  height: 0.6em;
  border-radius: 2px;
}

.imp-mix__legend b {
  color: var(--ui-900);
  font-weight: 500;
}

.imp-table {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.143em;
}

.imp-table__head,
.imp-row {
  display: grid;
  grid-template-columns: 1fr 6.6em 3.4em;
  align-items: center;
  gap: 0.571em;
  padding: 0 0.571em;
}

.imp-table__head {
  padding-bottom: 0.286em;
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-700);
  font-size: 0.857em;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  white-space: nowrap;
}

.imp-table__head span:not(:first-child),
.imp-row span:not(:first-child) {
  text-align: right;
}

.imp-row {
  height: 2.43em;
  border-radius: 0.429em;
  color: var(--ui-700);
}

.imp-cell--name {
  display: flex;
  align-items: center;
  gap: 0.43em;
  overflow: hidden;
  color: var(--ui-900);
  white-space: nowrap;
}

.imp-cell--cost {
  display: inline-block;
  font-weight: 500;
  transform-origin: right center;
}

.imp-row.is-winner {
  background: rgba(220, 250, 235, 0.55);
  box-shadow: inset 0 0 0 1.5px #25ae80;
}

.imp-row.is-winner .imp-cell--cost {
  color: var(--green-500);
}

.imp-row.is-flagged {
  background: rgba(253, 232, 232, 0.6);
  box-shadow: inset 0 0 0 1.5px var(--red-600);
}

.imp-row.is-flagged .imp-cell--cost {
  color: var(--red-600);
}

.imp-flag {
  align-self: flex-start;
  margin: 0.43em 0 0 0.286em;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.6em;
  border: 1px solid rgba(201, 55, 44, 0.35);
  border-radius: 0.286em;
  background: var(--red-100);
  color: var(--red-600);
  font-size: 0.857em;
  white-space: nowrap;
}

.imp-recs {
  right: -1%;
  bottom: -6%;
  width: 38%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.571em;
  padding: 1em;
  box-shadow: 0 1px 2px rgba(32, 41, 44, 0.08), 0 24px 48px -16px rgba(38, 33, 85, 0.35);
}

.imp-recs__head {
  font-weight: 500;
}

.imp-rec {
  display: flex;
  gap: 0.714em;
  padding: 0.714em;
  border: 1px solid var(--ui-line);
  border-radius: 0.571em;
  background: #fff;
}

.imp-rec__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.286em;
  height: 2.286em;
  border-radius: 0.571em;
  font-size: 1em;
}

.imp-rec__icon svg {
  font-size: 1.15em;
}

.imp-rec.is-opportunity .imp-rec__icon { background: var(--green-100); color: var(--green-500); }
.imp-rec.is-audience .imp-rec__icon { background: var(--blue-100); color: var(--blue-850); }
.imp-rec.is-alert .imp-rec__icon { background: var(--red-100); color: var(--red-600); }

.imp-rec__text {
  display: flex;
  flex-direction: column;
  gap: 0.143em;
  min-width: 0;
}

.imp-rec__text strong {
  font-weight: 500;
  line-height: 1.3;
}

.imp-rec__text > span:last-child {
  color: var(--ui-700);
  font-size: 0.857em;
}

.imp-rec__tag {
  color: var(--ui-700);
  font-size: 0.786em;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.imp-rec.is-opportunity .imp-rec__tag { color: var(--green-500); }
.imp-rec.is-audience .imp-rec__tag { color: var(--blue-850); }
.imp-rec.is-alert .imp-rec__tag { color: var(--red-600); }

@container (max-width: 479px) {
  .p26-demo--improve .p26-demo__stage {
    aspect-ratio: 4 / 5;
    font-size: clamp(10px, 3cqw, 12.5px);
  }

  .imp-chat {
    left: 5%;
    width: 90%;
  }

  .imp-report {
    left: 5%;
    top: 4%;
    width: 90%;
  }

  /* Phones keep the story to the table, the flag and the recommendations. */
  .imp-kpis,
  .imp-mix {
    display: none;
  }


  .imp-recs {
    right: 5%;
    bottom: -14%;
    width: 84%;
  }

  /* Keep the opportunity and the misconfiguration alert in the phone crop. */
  .imp-rec.is-audience {
    display: none;
  }
}

