/*
  Button 10 — Split Action Button — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is. `--button-accent` is a
  plain custom property — override it wherever this control is used.
*/

:root {
  --button-accent: #39ff14;
  --button-foreground: #0f172a;
  --button-border: #d4d4d8;
}

.split-btn {
  position: relative;
  display: inline-flex;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

/* `overflow: hidden` lives on this inner wrapper — not `.split-btn`
   itself — so it clips the two segments' own hover backgrounds to the
   shared rounded shape without also clipping `.split-btn__menu`, which
   needs to render outside this box's bounds. */
.split-btn__segments {
  display: inline-flex;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid var(--button-border);
  background-color: #ffffff;
}

.split-btn__main,
.split-btn__trigger {
  display: inline-flex;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--button-foreground);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.split-btn__main:hover,
.split-btn__trigger:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.split-btn__main:active,
.split-btn__trigger:active {
  background-color: rgba(0, 0, 0, 0.06);
}

.split-btn__main {
  padding: 0 1.25rem;
  font-size: 0.875rem;
}

.split-btn__trigger {
  width: 2.75rem;
  border-left: 1px solid var(--button-border);
}

.split-btn__trigger svg {
  width: 0.875rem;
  height: 0.875rem;
}

.split-btn__main:focus-visible,
.split-btn__trigger:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--button-accent);
  outline-offset: -2px;
}

.split-btn__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  min-width: 11rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid var(--button-border);
  background-color: #ffffff;
  padding: 0.375rem 0;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.25);
  list-style: none;
  margin: 0;
  transform-origin: top right;
  animation: split-btn-menu-in 140ms ease-out;
}

.split-btn__menu[hidden] {
  display: none;
}

@keyframes split-btn-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.split-btn__item {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 0.5rem 0.875rem;
  text-align: left;
  font: inherit;
  font-size: 0.875rem;
  color: var(--button-foreground);
  cursor: pointer;
}

.split-btn__item:hover,
.split-btn__item:focus-visible {
  background-color: rgba(0, 0, 0, 0.04);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .split-btn__menu {
    animation: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.button10-layout {
  display: flex;
  min-height: 20rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.button10-layout__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  padding: 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
