/* Document fragments and violation popovers based on the current brett editor. */
.intelligence-card-featured:has(.intelligence-demo-stage) {
  width: 100%;
  min-height: 560px;
  padding: clamp(1.5rem, 2.8vw, 2.5rem);
  gap: 1.5rem;
}
.intelligence-rule-card { background: linear-gradient(180deg, rgb(7 17 27 / .08), rgb(7 17 27 / .72)), url("assets/intelligence-gradient.svg") center / cover; }
.intelligence-rule-card .intelligence-card-copy h3 { color: #fff; }
.intelligence-rule-card .intelligence-card-copy p { color: rgba(252, 251, 248, .88); }
.intelligence-demo-stage { flex: 1; min-height: 0; display: grid; align-items: center; }
.intelligence-editor-preview {
  --editor-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --editor-fg: oklch(0.24 0.028 258);
  --editor-muted: oklch(0.44 0.02 259);
  --editor-border: oklch(0.89 0.012 258);
  --editor-brand: oklch(0.441 0.218 269);
  --editor-compliance: oklch(0.535 0.203 28);
  --editor-info-soft: oklch(0.95 0.04 248);
  --editor-info-strong: oklch(0.43 0.14 255);
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 370px;
  margin-inline: auto;
  color: var(--editor-fg);
  font: 400 13px/1.5 var(--editor-font);
  letter-spacing: normal;
  color-scheme: light;
}
.intelligence-editor-preview p { font: inherit; color: inherit; letter-spacing: normal; text-wrap: initial; }
.intelligence-editor-preview button { font-family: inherit; }
.intelligence-editor-preview button:focus-visible,
.intelligence-editor-preview a:focus-visible { outline: 2px solid var(--editor-brand); outline-offset: 3px; }
.intelligence-editor-preview button:disabled { cursor: default; }
.intelligence-fragment-label { display: block; color: var(--editor-muted); font-size: 10px; }
.intelligence-document-fragment,
.intelligence-rule-source { position: absolute; border: 1px solid var(--editor-border); border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgb(15 23 42 / .14); }
.intelligence-rule-controls {
  display: inline-flex;
  align-self: flex-start;
  max-width: 100%;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(252, 251, 248, .12);
  border-radius: 11px;
  background: var(--navy);
  box-shadow: 0 8px 22px rgb(7 17 27 / .16);
  cursor: default;
}
.intelligence-rule-controls > span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: rgba(252, 251, 248, .75);
  font-size: 11px;
  font-weight: 500;
  transition: background 200ms ease, color 200ms ease;
}
.intelligence-rule-controls > [aria-current="step"] { background: rgba(252, 251, 248, .13); color: var(--stone); }
.intelligence-rule-stage-label { display: grid; grid-template-columns: 0fr; margin-inline-start: 0; opacity: 0; transition: grid-template-columns 320ms var(--ease), margin-inline-start 320ms var(--ease), opacity 200ms; }
.intelligence-rule-stage-label > span { min-width: 0; overflow: hidden; white-space: nowrap; }
.intelligence-rule-controls > [aria-current="step"] .intelligence-rule-stage-label { grid-template-columns: 1fr; margin-inline-start: 6px; opacity: 1; }
.intelligence-rule-label-short { display: none; }
.intelligence-rule-controls svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.intelligence-rule-controls > span::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: #8eb8ff;
  opacity: 0;
  transform: scaleX(var(--rule-progress, 1));
  transform-origin: left;
}
.intelligence-rule-controls > [aria-current="step"]::after { opacity: .5; }
.intelligence-rule-preview:focus-visible { outline: 2px solid var(--stone); outline-offset: 8px; border-radius: 12px; }
.intelligence-document-fragment { top: 42px; left: 0; width: 100%; padding: 16px; }
.intelligence-document-fragment p { margin-top: 8px; font-size: 15px; line-height: 1.6; }
.intelligence-document-fragment mark { padding: 1px 2px; border-radius: 3px; background: color-mix(in oklab, var(--editor-compliance) calc(var(--rule-match, 1) * 20%), transparent); color: inherit; }
.intelligence-document-line { width: 66%; height: 5px; margin-top: 14px; border-radius: 4px; background: #e9ecf1; }
.intelligence-rule-source { top: 162px; left: 0; width: 100%; padding: 14px 16px; border-color: color-mix(in oklab, var(--editor-compliance) calc(var(--rule-match, 1) * 55%), var(--editor-border)); }
.intelligence-rule-source-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--editor-muted); font-size: 10px; }
.intelligence-rule-source-heading svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.intelligence-source-domain { margin-left: auto; font: 400 9px/1.5 var(--editor-font); text-transform: uppercase; letter-spacing: .05em; }
.intelligence-rule-source a { display: inline-block; margin-top: 7px; color: var(--editor-fg); font-size: 12px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--editor-border); text-underline-offset: 3px; }
.intelligence-rule-source p { margin-top: 4px; color: var(--editor-muted); font-size: 11px; line-height: 1.5; }
.intelligence-rule-suggestion { margin-top: 14px; overflow: hidden; border: 1px solid color-mix(in oklab, var(--editor-compliance) 26%, var(--editor-border)); border-radius: 8px; background: color-mix(in oklab, var(--editor-compliance) 5%, white); }
.intelligence-rewrite-heading { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid color-mix(in oklab, var(--editor-compliance) 20%, var(--editor-border)); background: color-mix(in oklab, var(--editor-compliance) 10%, oklch(0.989 0.002 259)); color: color-mix(in oklab, var(--editor-compliance) 72%, var(--editor-fg)); font-size: 12px; font-weight: 600; }
.intelligence-rewrite-heading svg { width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: var(--rule-rewrite-pulse, 1); }
.intelligence-rewrite-label { display: grid; align-items: center; }
.intelligence-rewrite-label > * { grid-area: 1 / 1; }
.intelligence-rewrite-body { display: grid; align-items: center; padding: 12px; }
.intelligence-rewrite-body > * { grid-area: 1 / 1; }
.intelligence-rule-suggestion p { margin: 0; color: var(--editor-fg); font-size: 14px; line-height: 1.625; font-weight: 500; }
.intelligence-rewrite-ready { opacity: var(--rule-rewrite-ready, 1); }
.intelligence-rewrite-loading { display: grid; gap: 10px; opacity: calc(1 - var(--rule-rewrite-ready, 1)); }
.intelligence-rewrite-skeleton { position: relative; display: block; overflow: hidden; height: 12px; border-radius: 6px; background: color-mix(in oklab, var(--editor-border) 45%, oklch(0.989 0.002 259)); }
.intelligence-rewrite-loading .intelligence-rewrite-skeleton:last-child { width: 92%; }
.intelligence-rewrite-skeleton-title { width: 80px; height: 8px; opacity: calc(1 - var(--rule-rewrite-ready, 1)); }
.intelligence-rewrite-skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .65) 50%, transparent 80%); transform: translateX(var(--rule-shimmer, -100%)); }
.intelligence-rule-preview :is(.intelligence-document-fragment, .intelligence-rule-source, .intelligence-rule-suggestion) { will-change: opacity, transform; }
.intelligence-rule-preview { display: flex; flex-direction: column; height: auto; }
.intelligence-rule-preview > :is(.intelligence-document-fragment, .intelligence-rule-source) { position: relative; top: auto; bottom: auto; left: auto; right: auto; flex-shrink: 0; }
.intelligence-rule-preview .intelligence-document-fragment { z-index: 1; margin-top: 10px; }
.intelligence-rule-preview .intelligence-rule-source { z-index: 2; margin-top: -18px; }
/* Match Meet brett's darkened glass without fading the text itself. */
.intelligence-rule-preview {
  --editor-fg: #f3f5f7;
  --editor-muted: #d1d7df;
  --editor-border: rgb(255 255 255 / .18);
  --editor-compliance: #ff8585;
}
.intelligence-rule-card :is(.intelligence-document-fragment, .intelligence-rule-source) {
  background: rgb(255 255 255 / .06);
  backdrop-filter: blur(8px) brightness(.35);
  -webkit-backdrop-filter: blur(8px) brightness(.35);
  box-shadow: 0 8px 24px rgb(0 0 0 / .08);
}
.intelligence-rule-card .intelligence-document-line { background: rgb(255 255 255 / .12); }
.intelligence-rule-card .intelligence-rule-suggestion { background: rgb(255 133 133 / .08); border-color: rgb(255 133 133 / .26); }
.intelligence-rule-card .intelligence-rewrite-heading { background: rgb(255 133 133 / .12); border-color: rgb(255 133 133 / .2); }
.intelligence-rule-card .intelligence-rewrite-skeleton { background: rgb(255 255 255 / .1); }
.intelligence-rule-card .intelligence-rewrite-skeleton::after { background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .16) 50%, transparent 80%); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .intelligence-rule-card :is(.intelligence-document-fragment, .intelligence-rule-source) { background: rgb(7 17 27 / .9); }
}
.intelligence-brand-document { position: absolute; inset: 12px 5% 40px 0; padding: 22px; overflow: hidden; border: 1px solid var(--editor-border); border-radius: 12px; background: #fff; box-shadow: 0 4px 16px rgb(15 23 42 / .04); }
.intelligence-brand-document .intelligence-document-title { margin-top: 12px; font-size: 20px; line-height: 1.3; letter-spacing: -.025em; }
.intelligence-brand-document .intelligence-document-body { max-width: 29ch; margin-top: 14px; font-size: 14px; line-height: 1.8; }
.intelligence-brand-document .intelligence-document-note { margin-top: 14px; color: var(--editor-muted); font-size: 9px; line-height: 1.5; }
.intelligence-brand-word { display: inline; padding: 0; border-radius: 3px; font: inherit; color: inherit; background-image: linear-gradient(var(--editor-brand), var(--editor-brand)); background-repeat: repeat-x; background-size: 100% 2px; background-position: 0 100%; }
.intelligence-brand-word:hover { background-color: color-mix(in oklab, var(--editor-brand) 8%, transparent); }
.intelligence-brand-card[data-applied="true"] .intelligence-brand-word { background-image: none; }
.intelligence-document-lines { display: grid; gap: 9px; margin-top: 20px; }
.intelligence-document-lines span { height: 5px; width: 94%; border-radius: 4px; background: #edf0f4; }
.intelligence-document-lines span:nth-child(2) { width: 84%; }
.intelligence-document-lines span:nth-child(3) { width: 62%; }
.intelligence-brand-marker { position: absolute; right: 8px; top: 129px; display: flex; align-items: center; justify-content: end; gap: 8px; min-width: 44px; min-height: 44px; color: var(--editor-brand); font-size: 9px; }
.intelligence-brand-marker i { width: 2px; height: 30px; border-radius: 2px; background: currentColor; }
.intelligence-brand-marker[hidden] { display: none; }
.intelligence-brand-popover { position: absolute; z-index: 2; top: 164px; right: 0; width: 88%; padding: 16px; border: 1px solid color-mix(in oklab, var(--editor-border) 75%, transparent); border-radius: 12px; background: rgb(255 255 255 / .96); box-shadow: 0 16px 34px rgb(15 23 42 / .18); backdrop-filter: blur(3px); animation: intelligence-popover-in 150ms ease-out; }
.intelligence-brand-popover[hidden] { display: none; }
.intelligence-brand-facet { display: inline-flex; padding: 1px 4px; border: 1px solid #d4e3ff; border-radius: 4px; background: #edf3ff; color: var(--editor-info-strong); font: 400 9px/1.5 var(--editor-font); text-transform: uppercase; letter-spacing: .05em; }
.intelligence-brand-popover .intelligence-popover-title { margin-top: 8px; color: var(--editor-muted); font-size: 11px; font-weight: 500; }
.intelligence-brand-popover .intelligence-popover-reason { margin-top: 6px; color: var(--editor-muted); font-size: 12px; line-height: 1.5; }
.intelligence-brand-replacement { display: block; width: fit-content; min-width: 44px; min-height: 44px; margin-top: 10px; padding: 6px 10px; border: 1px solid #d4e3ff; border-radius: 6px; background: var(--editor-info-soft); color: var(--editor-info-strong); font-size: 18px; font-weight: 500; line-height: 1.25; }
.intelligence-brand-replacement:hover { background: color-mix(in oklab, var(--editor-info-soft) 90%, var(--editor-brand)); }
.intelligence-brand-dismiss { display: flex; align-items: center; gap: 7px; min-height: 44px; margin: 4px 0 -6px -6px; padding: 6px; border-radius: 6px; color: var(--editor-muted); font-size: 15px; }
.intelligence-brand-dismiss:hover { background: #f4f4f4; }
.intelligence-brand-dismiss svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.intelligence-brand-demo-controls { position: absolute; bottom: -8px; left: 0; right: 0; display: flex; justify-content: flex-end; }
.intelligence-brand-reset { min-height: 44px; padding: 8px 0 8px 12px; color: var(--editor-muted); font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.intelligence-brand-reset[hidden] { display: none; }
.intelligence-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes intelligence-popover-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
@media (max-width: 1400px) {
  .intelligence-card-featured:has(.intelligence-demo-stage) { padding: 1.5rem; gap: 1rem; }
}
@media (max-width: 1100px) { .intelligence-card-featured:has(.intelligence-demo-stage) { grid-column: span 2; } }
@media (max-width: 600px) {
  .intelligence-card-featured:has(.intelligence-demo-stage) { grid-column: auto; padding: 1rem; }
  .intelligence-document-fragment { padding: 12px; }
  .intelligence-document-fragment p { font-size: 13px; }
  .intelligence-rule-source { padding: 12px; }
  .intelligence-rule-source-heading { font-size: 9px; }
  .intelligence-rule-controls > span { padding-inline: 10px; }
  .intelligence-rule-label-full { display: none; }
  .intelligence-rule-label-short { display: inline; }
  .intelligence-source-domain { display: none; }
  .intelligence-brand-document { padding: 14px; }
  .intelligence-brand-document .intelligence-document-title { font-size: 18px; }
  .intelligence-brand-document .intelligence-document-body { font-size: 13px; line-height: 1.8; }
  .intelligence-brand-marker span { display: none; }
  .intelligence-brand-popover { top: 152px; width: 95%; padding: 12px; }
  .intelligence-brand-popover .intelligence-popover-reason { font-size: 11px; }
}
@media (max-width: 360px) {
  .intelligence-card-featured:has(.intelligence-demo-stage) { min-height: 608px; }
  .intelligence-rule-controls > span { min-width: 34px; padding-inline: 6px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .intelligence-editor-preview *, .intelligence-brand-popover { transition: none !important; animation: none !important; }
  .intelligence-rule-controls > span::after { display: none; }
}
