/* Blekline benchmark embeds — Webflow Site Head (load once)
 * Works with full embed HTML (.bl-bench-root) or inner content pasted without wrapper.
 */

.w-embed:has(.bl-bench-root),
.w-embed:has(> .bl-bench-meta),
.w-embed:has(> .bl-bench-table),
.w-embed:has(> .bl-bench-cards),
.w-embed:has(> .bl-bench-latency-panel),
.w-embed:has(> .bl-bench-heading) {
  --bl-bench-max-width: 1200px;
  --bl-bench-gutter: clamp(16px, 4vw, 32px);
  --bl-bench-span: min(calc(100vw - 2 * var(--bl-bench-gutter)), var(--bl-bench-max-width));
  --bl-bench-stack-gap: clamp(48px, 6vw, 88px);
  display: block;
  width: var(--bl-bench-span);
  max-width: var(--bl-bench-max-width);
  margin-left: auto;
  margin-right: auto;
  overflow: visible;
  flex-shrink: 0;
}

/* Sibling Code Embeds (correct Webflow structure) */
.w-embed:has([class*="bl-bench-"]) + .w-embed:has([class*="bl-bench-"]) {
  margin-top: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
}

/* Nested Code Embeds inside one block (staging fallback) */
.w-embed:has([class*="bl-bench-"]) > .w-embed {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
  margin-left: 0;
  margin-right: 0;
}

/* Sections stacked inside one embed without .bl-bench-root wrapper */
.w-embed > .bl-bench-scroll-shell ~ .w-embed,
.w-embed > .bl-bench-scroll-shell ~ .bl-bench-cards,
.w-embed > .bl-bench-footer ~ .w-embed,
.w-embed > .bl-bench-footer ~ .bl-bench-cards,
.w-embed > .bl-bench-cards ~ .w-embed,
.w-embed > .bl-bench-cards ~ .bl-bench-heading,
.w-embed > .bl-bench-latency-panel ~ .bl-bench-heading,
.w-embed > .bl-bench-latency-panel ~ .w-embed {
  margin-top: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
}

/* Webflow flex parent — gap fallback when design token missing on publish */
[data-spacing-vertical="xlarge"]:has(.w-embed [class*="bl-bench-"]) {
  display: flex;
  flex-direction: column;
  gap: var(--structure-management--structure-xlarge-11, var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px)));
}

[data-spacing-vertical="large"]:has(.w-embed [class*="bl-bench-"]) {
  display: flex;
  flex-direction: column;
  gap: var(--structure-management--structure-large-11, var(--bl-bench-stack-gap, clamp(40px, 5vw, 72px)));
}

.flex:has(> .w-embed [class*="bl-bench-"]):not([data-spacing-vertical]) {
  gap: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
}

/* Legacy: nested inside .bl-bench-root */
.bl-bench-root > .w-embed:has([class*="bl-bench-"]) {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
  margin-left: 0;
  margin-right: 0;
}

.w-embed > .bl-bench-root ~ .bl-bench-root {
  margin-top: var(--bl-bench-stack-gap, clamp(48px, 6vw, 88px));
}

.bl-bench-root,
.w-embed:has(> .bl-bench-meta) {
  font-family: system-ui, -apple-system, sans-serif;
  color: #e8e8e8;
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.bl-bench-root *,
.bl-bench-root *::before,
.bl-bench-root *::after,
.w-embed:has(> .bl-bench-meta) *,
.w-embed:has(> .bl-bench-meta) *::before,
.w-embed:has(> .bl-bench-meta) *::after {
  box-sizing: border-box;
}

.bl-bench-scroll-hint {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #a3a3a3;
  letter-spacing: 0.02em;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  line-height: 1.35;
}

.bl-bench-scroll-hint::after {
  content: "→";
  color: #f97316;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 11px;
  margin-left: auto;
}

/* Edge fades + hidden scrollbar (no stock OS chrome) */
.bl-bench-scroll-shell {
  position: relative;
}

.bl-bench-scroll-shell::before,
.bl-bench-scroll-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 4;
  border-radius: 8px;
  display: none;
}

.bl-bench-scroll-shell::before {
  left: 0;
  background: linear-gradient(to right, #141414 15%, transparent 100%);
}

.bl-bench-scroll-shell::after {
  right: 0;
  background: linear-gradient(to left, #141414 15%, transparent 100%);
}

.bl-bench-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #141414;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bl-bench-table-wrap::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

.bl-bench-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  background: #141414;
  margin: 0;
}

.bl-bench-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid #2a2a2a;
  font-weight: 500;
  white-space: nowrap;
  background: #141414;
}

.bl-bench-table th.bl-bench-accent { color: #f97316; }

.bl-bench-table th.bl-bench-muted { color: #a3a3a3; }

.bl-bench-table td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #1f1f1f;
  color: #c4c4c4;
  background: #141414;
}

.bl-bench-table td:not(.bl-bench-sticky-col) {
  text-align: center;
  min-width: 88px;
}

.bl-bench-table tr:last-child td { border-bottom: 0; }

.bl-bench-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 148px;
  max-width: 200px;
  text-align: left !important;
  border-right: 1px solid #2a2a2a;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.35);
}

.bl-bench-table thead .bl-bench-sticky-col {
  z-index: 3;
}

.bl-bench-scenario-title {
  color: #fafafa;
  font-weight: 600;
  display: block;
}

.bl-bench-scenario-sub {
  font-size: 13px;
  color: #a3a3a3;
  display: block;
  margin-top: 4px;
  line-height: 1.35;
  white-space: normal;
}

.bl-bench-table code {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 11px;
  background: #1f1f1f;
  padding: 1px 5px;
  border-radius: 3px;
  color: #a0c4a0;
}

.bl-bench-chip {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-family: 'SF Mono', ui-monospace, monospace;
  white-space: nowrap;
}

.bl-bench-pass { background: #1f2d1f; color: #6ea86e; border: 1px solid #2d432d; }
.bl-bench-partial { background: #2d2a1f; color: #d4a574; border: 1px solid #433d2d; }
.bl-bench-fail { background: #2d1f1f; color: #d46e6e; border: 1px solid #432d2d; }
.bl-bench-na { background: #1f1f1f; color: #525252; border: 1px solid #2a2a2a; }

.bl-bench-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.bl-bench-card {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 16px;
}

.bl-bench-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
}

.bl-bench-card-row-label {
  color: #a3a3a3;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}

.bl-bench-card-id {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #f97316;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bl-bench-card-title {
  font-weight: 600;
  color: #fafafa;
  margin: 8px 0 4px;
}

.bl-bench-card-q {
  color: #a3a3a3;
  font-size: 13px;
  margin-bottom: 12px;
}

.bl-bench-latency-panel {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 16px 18px;
  margin: 12px 0 4px;
}

.bl-bench-latency-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.bl-bench-latency-bar:first-child {
  margin-top: 0;
}

.bl-bench-latency-bar:last-child {
  margin-bottom: 0;
}

.bl-bench-latency-label {
  width: 120px;
  font-size: 13px;
  color: #a3a3a3;
  flex-shrink: 0;
}

.bl-bench-latency-track {
  flex: 1;
  min-width: 0;
  height: 10px;
  background: #1a1a1a;
  border: 1px solid #666;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}

.bl-bench-latency-fill {
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, #ff9a6a, #fb651e);
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(251, 101, 30, 0.35);
}

.bl-bench-latency-val {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #a0c4a0;
  width: 72px;
  text-align: right;
  flex-shrink: 0;
}

.bl-bench-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #2a2a2a;
  font-size: 13px;
  color: #a3a3a3;
  line-height: 1.55;
}

.bl-bench-footer a {
  color: #f97316;
  text-decoration: none;
  word-break: break-word;
}

.bl-bench-footer a:hover { text-decoration: underline; }

.bl-bench-meta {
  font-size: 12px;
  color: #525252;
  margin-bottom: 16px;
  line-height: 1.45;
}

.bl-bench-heading {
  font-weight: 600;
  color: #fafafa;
  margin-bottom: 4px;
}

@media (max-width: 767px) {
  .bl-bench-root {
    font-size: 13px;
  }

  .bl-bench-scroll-hint {
    display: flex;
  }

  .bl-bench-scroll-shell::before,
  .bl-bench-scroll-shell::after {
    display: block;
  }

  .bl-bench-table {
    min-width: 580px;
  }

  .bl-bench-table th,
  .bl-bench-table td {
    padding: 10px 12px;
  }

  .bl-bench-sticky-col {
    min-width: 132px;
  }

  .bl-bench-scenario-sub {
    font-size: 12px;
  }

  .bl-bench-chip {
    font-size: 10px;
    padding: 2px 6px;
  }

  .bl-bench-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bl-bench-latency-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .bl-bench-latency-label {
    width: 100%;
  }

  .bl-bench-latency-val {
    width: auto;
    margin-left: auto;
  }

  .bl-bench-footer {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .bl-bench-scroll-shell::before,
  .bl-bench-scroll-shell::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .bl-bench-table {
    min-width: 520px;
  }

  .bl-bench-sticky-col {
    min-width: 118px;
  }

  .bl-bench-table td:not(.bl-bench-sticky-col) {
    min-width: 76px;
  }
}
