/*
  3D buttons (DECISIONS.md, "Buttons are 3D"): every filled button gets a light top edge, a
  soft fade from top to bottom and a darker ledge under it, and sinks onto its ledge when
  pressed. Plain link buttons stay flat.

  Its own file, linked after every page's stylesheet (common/base.html), and written with
  `background-image` and `box-shadow` only, so the colours stay whatever base.css, quotes.css
  and the company (Darner green, Uchuma gray) make them; the selectors are specific enough to
  win over a page's own `.app-main .button` rules. The ledge colour is --ledge, set per kind.
*/

.button:not(.button--link),
.company-switch .company-switch__button,
.sq-button,
input[type="file"]::file-selector-button {
  --ledge: color-mix(in srgb, var(--accent) 58%, black);
  --lift: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0.04) 50%,
    rgba(0, 0, 0, 0.1)
  );
  position: relative;
  background-image: var(--lift);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 3px 0 var(--ledge),
    0 5px 8px rgba(0, 0, 0, 0.22);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.08s ease,
    transform 0.08s ease;
}

.button:not(.button--link):hover,
.company-switch .company-switch__button:hover,
.sq-button:hover,
input[type="file"]::file-selector-button:hover {
  background-image: var(--lift);
}

/* Pressed: down onto the ledge. */
.button:not(.button--link):active,
.company-switch .company-switch__button:active,
.sq-button:active,
input[type="file"]::file-selector-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.2),
    0 0 0 var(--ledge),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Each kind's ledge in its own colour. */
.button.button--save {
  --ledge: color-mix(in srgb, var(--accent-save) 58%, black);
}

.button.button--secondary {
  --ledge: color-mix(in srgb, var(--ink) 28%, var(--bg-panel));
}

.button.button--danger {
  --ledge: color-mix(in srgb, var(--color-danger) 45%, black);
}

/* An outlined company button (the one not chosen) on its company's own ledge. */
.company-switch .company-switch__button:not(.company-switch__button--on) {
  background-image: none;
}

.button:disabled,
.button[aria-disabled="true"] {
  transform: none;
  box-shadow: none;
  background-image: none;
}
