/* MIT adaptations: Flowpane Button, Johuniq RainbowButton, Halaska SegmentedControl,
   Origin UI Input/Textarea. Exact originals and licenses are listed in
   design-system/20261028-workspace-sources.md. No React runtime is required. */

/* Flowpane's distinct primary/secondary/ghost/danger variants, using brand tokens.
   Keep native disabled and the application's existing double-submit guards. */
button.primary, button.secondary, button.quiet, button.danger {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.4;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
button.secondary {
  background: var(--surface);
  border: 1px solid var(--control-border);
  color: var(--ink);
}
button.secondary:hover:not(:disabled), button.quiet:hover:not(:disabled) {
  background: var(--sky);
}
button.quiet { background: transparent; color: var(--ink-secondary); }
button.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: workspace-spin 700ms linear infinite;
}
@keyframes workspace-spin { to { transform: rotate(360deg); } }

/* RainbowButton: layered rotating border. Only the primary creation action uses
   this accent, with a blue spectrum and motion limited to hover/focus. */
@property --workspace-angle { syntax: "<angle>"; initial-value: 135deg; inherits: false; }
#new-post {
  border: 2px solid transparent;
  background: linear-gradient(var(--action-top), var(--action)) padding-box,
    conic-gradient(from var(--workspace-angle), var(--action), var(--accent), var(--sky), var(--action)) border-box;
  box-shadow: 0 4px 12px var(--shadow-card), inset 0 1px var(--glass-highlight);
}
#new-post:hover:not(:disabled), #new-post:focus-visible {
  animation: workspace-border 2200ms linear infinite;
  box-shadow: 0 5px 16px var(--glass-shadow), inset 0 1px var(--glass-highlight);
}
@keyframes workspace-border { to { --workspace-angle: 495deg; } }

/* Halaska's measured sliding thumb, attached to the existing accessible tabs. */
#editor .editor-tabs { isolation: isolate; gap: 4px; border-bottom: 1px solid var(--border); }
.workspace-segment-thumb {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--sky);
  box-shadow: 0 1px 3px var(--shadow-card);
  pointer-events: none;
  transition: transform 350ms cubic-bezier(.2,0,0,1);
}
#editor .editor-tabs button { position: relative; background: transparent; min-width: 0; white-space: normal; }
#editor .editor-tabs button[aria-selected="true"] { background: transparent; color: var(--ink); }

/* Origin UI fields: clear label/input spacing, a visible ring, error state and
   quiet placeholders. Existing manual text resizing and full-screen writing stay. */
#editor input:not([type="checkbox"]), #editor textarea, .user-form input {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--control-border);
  border-radius: 10px;
}
#editor :is(input, textarea):focus-visible, .user-form input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
#editor :is(input, textarea)[aria-invalid="true"] { border-color: var(--danger); }
#editor input::placeholder, #editor textarea::placeholder { color: var(--placeholder); }

/* Status is conveyed by both a label and a dot; color is never the sole cue. */
.post-card .badge { display: inline-flex; align-items: center; gap: 6px; white-space: normal; }
.post-card .badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.filters .lens-filter-count { background: var(--surface); color: var(--ink-secondary); padding: 2px 6px; }
.filters button.selected .lens-filter-count { background: var(--sky); color: var(--ink); }

html[data-effects="reduced"] #new-post { animation: none; }
@media (prefers-reduced-motion: reduce) {
  #new-post, button[aria-busy="true"]::after { animation: none !important; }
  .workspace-segment-thumb { transition: none; }
}
@media (forced-colors: active) {
  #new-post { background: ButtonFace; color: ButtonText; border-color: ButtonText; }
  .workspace-segment-thumb { border-color: Highlight; }
}
