/* ==========================================================================
   Prototype UI (notes/input-controls-for-refinement.html)

   Low-fi shadcn/ui look (neutral theme, new-york): Card, Button, Badge and a
   stepper, rebuilt as plain CSS scoped to .proto-ui so nothing leaks into the
   note's own type and spacing. Each prototype adds its own file on top:
   tradeoff-graph.css and bubble-cluster.css.
   ========================================================================== */

.proto-ui {
  --bd-background: oklch(1 0 0);
  --bd-foreground: oklch(0.145 0 0);
  --bd-primary: oklch(0.205 0 0);
  --bd-muted: oklch(0.97 0 0);
  --bd-muted-foreground: oklch(0.556 0 0);
  --bd-accent: oklch(0.97 0 0);
  --bd-border: oklch(0.922 0 0);
  --bd-ring: oklch(0.708 0 0);
  --bd-radius: 10px;

  display: grid;
  gap: 16px;
  margin: var(--space-md) 0 var(--space-lg);
  color: var(--bd-foreground);
  font-size: 14px;
  line-height: 1.4;
}

.proto-ui *,
.proto-ui *::before,
.proto-ui *::after {
  box-sizing: border-box;
}

.proto-ui .bd-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 560px) {
  .proto-ui .bd-row {
    grid-template-columns: 1fr;
  }
}

/* "Try the prototypes" lands with the first prototype's heading a little
   below the top of the window, not hard against it. */
#prototypes {
  scroll-margin-top: 100px;
}

/* …and glides there. Only on this note, so other pages' scripted scrolls
   stay instant. */
@media (prefers-reduced-motion: no-preference) {
  html:has(#prototypes) {
    scroll-behavior: smooth;
  }
}

/* Card */
.proto-ui .bd-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  background: var(--bd-background);
  border: 1px solid var(--bd-border);
  border-radius: calc(var(--bd-radius) + 4px);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.proto-ui .bd-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.proto-ui .bd-card-title {
  font-weight: 600;
  line-height: 1;
}

.proto-ui .bd-separator {
  height: 1px;
  margin: 4px -20px 0;
  background: var(--bd-border);
}

.proto-ui .bd-subtle {
  color: var(--bd-muted-foreground);
}

/* Button: ghost and outline, size sm */
.proto-ui .bd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: calc(var(--bd-radius) - 2px);
  background: transparent;
  color: var(--bd-muted-foreground);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}

.proto-ui .bd-btn--outline {
  height: 32px;
  border-color: var(--bd-border);
  background: var(--bd-background);
  color: var(--bd-foreground);
  font-size: 13px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.proto-ui .bd-btn:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--bd-ring) 50%, transparent);
}

.proto-ui .bd-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

@media (hover: hover) {
  .proto-ui .bd-btn:hover {
    background: var(--bd-accent);
    color: var(--bd-foreground);
  }
}

/* Stepper: one bordered group, so the dividers and outer edge always line
   up. Disabling a button fades only its glyph. */
.proto-ui .bd-stepper {
  display: inline-flex;
  height: 32px;
  border: 1px solid var(--bd-border);
  border-radius: calc(var(--bd-radius) - 2px);
  background: var(--bd-background);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  overflow: hidden;
}

.proto-ui .bd-stepper .bd-btn {
  width: 32px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--bd-foreground);
  font-size: 15px;
}

.proto-ui .bd-stepper .bd-btn:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in oklch, var(--bd-ring) 60%, transparent);
}

.proto-ui .bd-stepper .bd-btn:disabled {
  opacity: 1;
  color: color-mix(in oklch, var(--bd-foreground) 30%, transparent);
}

.proto-ui .bd-stepper output {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  border-inline: 1px solid var(--bd-border);
  font-variant-numeric: tabular-nums;
}

/* Right side of a card header */
.proto-ui .bd-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proto-ui .bd-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

/* Badge: outline, and a struck-out one for what was left out */
.proto-ui .bd-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proto-ui .bd-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--bd-border);
  border-radius: calc(var(--bd-radius) - 2px);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.proto-ui .bd-badge span {
  color: var(--bd-muted-foreground);
  font-variant-numeric: tabular-nums;
}

.proto-ui .bd-badge--off {
  border-style: dashed;
  color: var(--bd-muted-foreground);
  text-decoration: line-through;
}

/* Tabs: a muted track with the active tab raised */
.proto-ui .bd-tabs {
  display: inline-flex;
  height: 32px;
  padding: 3px;
  border-radius: calc(var(--bd-radius) - 2px);
  background: var(--bd-muted);
}

.proto-ui .bd-tab {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--bd-radius) - 4px);
  background: transparent;
  color: var(--bd-muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition: background-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}

.proto-ui .bd-tab[aria-selected="true"] {
  background: var(--bd-background);
  color: var(--bd-foreground);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.proto-ui .bd-tab:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--bd-ring) 50%, transparent);
}

/* The readout as plain prose, under its badges */
.proto-ui .bd-prose {
  margin: 0;
  padding: 10px 12px;
  border-radius: calc(var(--bd-radius) - 2px);
  background: var(--bd-muted);
  color: var(--bd-foreground);
  font-size: 13px;
  line-height: 1.5;
}
