/* Button Component - Pure CSS without nesting for compatibility */

.btn {
  display: inline-block;
  padding: var(--space-xxs) var(--space-m) !important;
  border-radius: var(--border-radius) !important;
  background-color: transparent;
  border: solid 2px transparent !important;
  font-weight: bold !important;
  text-decoration: none !important;
  cursor: pointer !important;
  outline: none !important;
  transition:
    background-color 200ms,
    filter 200ms,
    color 200ms !important;
}

/* Primary button modifier */
.btn--primary {
  color: var(--color-white) !important;
  background-color: var(--color-red) !important;
}

.btn--primary:hover,
.btn--primary:focus,
.btn--primary:focus-within,
.btn--primary:active {
  color: var(--color-white) !important;
  background-color: var(--color-red-dark) !important;
}

/* Secondary button modifier */
.btn--secondary {
  color: var(--color-white) !important;
  background-color: var(--color-green) !important;
}

.btn--secondary:hover,
.btn--secondary:focus,
.btn--secondary:focus-within,
.btn--secondary:active {
  color: var(--color-white) !important;
  background-color: var(--color-green-dark) !important;
}

/* Light button modifier */
.btn--light {
  color: var(--color-ink-dark) !important;
  background-color: var(--color-gray-light) !important;
}

.btn--light:hover,
.btn--light:focus,
.btn--light:focus-within,
.btn--light:active {
  color: var(--color-ink-dark) !important;
  filter: brightness(92%) !important;
}

/* Dark button modifier */
.btn--dark {
  color: var(--color-white) !important;
  border-color: var(--color-ink-dark) !important;
  background-color: var(--color-ink-dark) !important;
}

.btn--dark:hover,
.btn--dark:focus,
.btn--dark:focus-within,
.btn--dark:active {
  color: var(--color-white) !important;
}

/* Round button modifier */
.btn--round {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50% !important;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Square icon button modifier */
.btn--square {
  display: inline-grid !important;
  place-items: center;
  padding: 0 !important;
  width: 1.75em;
  height: 1.75em;
}

.btn--small {
  padding: 0.15rem 0.7rem !important;
  font-size: 0.8125rem !important;
}

/* Simple button styles */
.button {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-blue);
  text-decoration: none !important;
  cursor: pointer;
  transition: color 200ms !important;
}

.button:hover,
.button:focus,
.button:active {
  color: var(--color-blue-bright);
}

/* Navigation button modifier */
.button--nav {
  border-bottom: 0.3rem transparent solid;
}

.button--nav:hover {
  border-bottom: 0.3rem var(--lime-green) solid;
  cursor: pointer;
}

/* Handle for drag elements */
.handle {
  cursor: move;
}

/* Dark link styles */
.link-dark {
  color: var(--color-ink-body);
}

.link-dark:hover,
.link-dark:focus,
.link-dark:active {
  color: var(--color-ink-body);
}

/* Circle button for icon-only buttons */
.btn--circle {
  --btn-size: 2rem;

  display: inline-grid !important;
  place-items: center;
  padding: 0 !important;
  aspect-ratio: 1;
  inline-size: var(--btn-size);
  block-size: var(--btn-size);
}

/* Negative/destructive button */
.btn--negative {
  color: var(--color-red) !important;
}

.btn--negative:hover,
.btn--negative:focus,
.btn--negative:active {
  color: var(--color-red-dark) !important;
}

/* Translucent button - semi-transparent until hovered */
.btn.translucent {
  opacity: 0.5;
  transition: opacity 150ms ease;
}

.btn.translucent:hover,
.btn.translucent:focus {
  opacity: 1;
}

/* Dark mode: btn--dark stays dark instead of auto-inverting to near-white */
html[data-theme="dark"] .btn--dark {
  background-color: var(--color-gray) !important;
  border-color: var(--color-gray) !important;
  color: var(--color-ink) !important;
}

html[data-theme="dark"] .btn--dark:hover,
html[data-theme="dark"] .btn--dark:focus,
html[data-theme="dark"] .btn--dark:focus-within,
html[data-theme="dark"] .btn--dark:active {
  color: var(--color-ink) !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .btn--dark {
    background-color: var(--color-gray) !important;
    border-color: var(--color-gray) !important;
    color: var(--color-ink) !important;
  }

  html:not([data-theme]) .btn--dark:hover,
  html:not([data-theme]) .btn--dark:focus,
  html:not([data-theme]) .btn--dark:focus-within,
  html:not([data-theme]) .btn--dark:active {
    color: var(--color-ink) !important;
  }
}
