/* Button */ .button, [type='button'], [type='submit'] { /* Some styles don't apply to links since they are inline elements by default. */ display: inline-block; font-family: var(--ff-headings); text-decoration: none; text-align: center; width: fit-content; padding: 0.5rem 1rem; text-box-trim: trim-both; text-box-edge: cap alphabetic; /* Improve usability and consistency of cursor style between image-type `input` and others. */ cursor: pointer; color: var(--color-button-text); background: linear-gradient(var(--color-button), var(--color-button-hover)); border: 1px solid var(--color-button-hover); border-radius: var(--radius-s); &:hover, &:focus-visible, &:active { /* Override any link underlines and color changes. */ text-decoration: none; color: var(--color-button-text-hover); background: linear-gradient(var(--color-button-hover), var(--color-button)); } &:active { box-shadow: inset 2px 2px 5px var(--color-black-40); } } .button--small { font-size: var(--fs-xs); padding: 0.35rem 0.5rem; } .button--alt { color: var(--color-button-text-hover); background: var(--color-button-hover); &:hover, &:focus-visible, &:active { color: var(--color-button-text); background: var(--color-button); } } .button--outline { color: var(--color-button); background: var(--color-button-text); } .button--accept, .button--decline, .button--delete { --color-button: currentColor; --color-button-text: light-dark( oklch(from var(--color-button) l c h), oklch(from var(--color-button) 100% 0.03 h) ); --color-button-bg: light-dark( oklch(from var(--color-button) 100% 0.03 h), oklch(from var(--color-button) calc(l - 0.3) c h) ); --color-button-border: light-dark( oklch(from var(--color-button) calc(l + 0.2) c h), oklch(from var(--color-button) calc(l - 0.07) c h) ); --color-button-hover: light-dark( oklch(from var(--color-button) 90% 0.03 h), oklch(from var(--color-button) calc(l - 0.6) c h) ); color: var(--color-button-text); background: linear-gradient(var(--color-button-bg), var(--color-button-hover)); border-color: var(--color-button-border); &:hover, &:focus-visible, &:active { color: var(--color-button-text); background: linear-gradient(var(--color-button-hover), var(--color-button-bg)); } } .button--accept { --color-button: var(--color-success); } .button--decline { --color-button: var(--color-warning); } .button--delete { --color-button: var(--color-error); } /* The disabled variation should always go last, so that it overrides any other variations. */ .button, [type='button'], [type='submit'] { &:disabled { color: var(--color-disabled); background-color: var(--color-disabled-alt); border: 1px solid var(--color-disabled); background-image: none; text-shadow: none; cursor: default; &:hover, &:focus, &:active { /* Override any link underlines and color changes. */ color: var(--color-disabled); background-color: var(--color-disabled-alt); text-decoration: none; } } } /* For forms with multiple fields show submit button below the form. */ input:not(:only-of-type), textarea { & + [type='submit'] { display: block; } } /* For forms on mobile with single field add space between it and the submit button. */ @media (width >= 666px) { input:only-of-type { &:has(+ [type='submit']) { margin-inline-end: 0.5rem; } } }