/* stylelint-disable selector-class-pattern */
/* stylelint-disable comment-empty-line-before */
/* stylelint-disable custom-property-pattern */
/* =========================================================================
   FILENAME: buttons.css
   ROLE: Global Engine Button & Interactive Trigger Palette
   SCOPE: Direct skinning, behavior, and structural spacing for interactive actions.
   ========================================================================= */

/* =========================================================================
   1. GLOBAL CALL TO ACTION AFFORDANCES
   ========================================================================= */
.button-cta {
  background-color: var(--action-primary);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--surface-border);
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  padding: 0.75rem 1.5rem;
}

.button-cta:active {
  box-shadow: 0 1px 0 var(--surface-border);
  transform: translateY(3px);
}

.button a {
  background-color: var(--action-accent);
  color: contrast-color(var(--action-accent));
  box-shadow: 0 4px 0 var(--surface-border);
}

.button a:hover {
  filter: brightness(1.05);
}

.button a:active {
  box-shadow: 0 1px 0 var(--surface-border);
}

/* Hover styles: Only apply to devices with true hover support */
@media (hover: hover) and (pointer: fine) {
  .button-cta:hover {
    background-color: var(--action-accent);
    transform: translateY(-2px); /* Subtle lift effect */
  }  
}

/* Disable hover on finger-touch targets to prevent sticky hover states */
@media (pointer: coarse) {
  /* .hover: none; - Cleaned up syntax assignment error */
}

/* =========================================================================
   2. FLOATING IMAGE OVERLAYS
   ========================================================================= */
.rotate-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.rotate-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* =========================================================================
   3. PAIRWISE HEAD-TO-HEAD VOTE CHOICE TRIGGERS
   ========================================================================= */
.compare-grid button {
  width: 100%;       /* Stretch across the full 1fr track width */
  height: 100%;      /* Stretch to fill the fixed 120px track height */
  box-sizing: border-box;
  white-space: normal; 
  word-break: break-word;
  padding: 15px;
  border-radius: var(--radius, 8px);
  background-color: var(--action-primary);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--surface-border);
  border: 1px solid var(--surface-border);
}

.vote-card button {
  display: block;
  width: 100%;
  padding: 24px 16px;
  border-width: 2px;
  border-style: solid;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Consolidated Compare Option Buttons */
.engine-viewport-canvas .compare-option__button {
  display: block;
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  text-align: center;
  padding: 1.25rem 1rem;
  border: 1px solid var(--surface-border);
  background: var(--surface-primary);
  color: var(--text-primary);
  border-radius: var(--radius, 8px);
  /* Transition covers border-color for hover and the pulse reset */
  transition: border-color 0.15s ease, background 0.15s ease;
}

.engine-viewport-canvas .compare-option__button:hover,
.engine-viewport-canvas .compare-option__button:focus-visible {
  border-color: var(--action-primary);
  background: var(--surface-secondary);
}

/* Pulse keyframe: border flares to accent colour then fades back.
   Short duration (300ms) keeps it snappy — it should feel like
   a confirmation tap, not an animation sequence. */
@keyframes compare-button-pulse {
  0%   { border-color: var(--surface-border); box-shadow: none; }
  30%  { border-color: var(--action-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action-primary) 25%, transparent); }
  100% { border-color: var(--surface-border); box-shadow: none; }
}

/* Applied via JS on mousedown/touchstart — class is removed once
   the animation ends so re-tapping re-triggers it cleanly. */
.engine-viewport-canvas .compare-option__button.is-selected {
  animation: compare-button-pulse 300ms ease-out forwards;
}

/* =========================================================================
   4. WORKSPACE ACTIONS ROW MATRIX OVERRIDES
   ========================================================================= */
.engine-actions-row .button {
  padding: 10px 20px;
  border-radius: var(--radius, 4px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  background-color: var(--action-primary);
  color: var(--text-button, #ffffff);
}

/* Form Action Submission Variants */
.engine-viewport-canvas .button--submit {
  background-color: var(--action-primary);
  color: var(--text-button, #ffffff);
}

.engine-viewport-canvas .button--submit:hover {
  background-color: var(--action-accent);
  color: contrast-color(var(--action-accent));
  filter: brightness(1.08);
}

.engine-viewport-canvas .button--submit:active {
  background-color: var(--action-primary-active);
  color: contrast-color(var(--action-primary-active));
}

/* Form Action Purge/Clear Variants */
.engine-viewport-canvas .button--clear {
  background-color: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
}

.engine-viewport-canvas .button--clear:hover {
  background-color: var(--surface-primary);
  color: contrast-color(var(--surface-primary));
  border-color: var(--action-primary);
}

/* =========================================================================
   5. COMPACT NAVIGATION GRID BUTTONS
   ========================================================================= */
.nav-matrix-summary {
  background-color: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-matrix-summary:hover {
  background-color: var(--placeholder-secondary);
}

.button-secondary {
  background: var(--action-primary);
  border: 1px solid currentcolor;
  color: contrast-color(var(--action-primary));
}

.engine-input__back {
  margin-bottom: 1rem;
}