fixin.me/app/assets/stylesheets/application.css

524 lines
10 KiB
CSS

/*
* This is a manifest file that'll be compiled into application.css, which will
* include all the files listed below.
*
* Any CSS (and SCSS, if configured) file within this directory,
* lib/assets/stylesheets, or any plugin's vendor/assets/stylesheets directory
* can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at
* the bottom of the compiled file so the styles you add here take precedence
* over styles defined in any other CSS files in this directory. Styles in this
* file should be added after the last require_* statement. It is generally
* better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
:root {
--color-focus-gray: #f3f3f3;
--color-border-gray: #dddddd;
--color-nav-gray: #c7c7c7;
--color-gray: #a0a0a0;
--color-table-gray: #909090;
--color-text-gray: #707070;
--color-dark-blue: #006c9b;
--color-blue: #009ade;
--color-dark-red: #b21237;
--color-red: #ff1f5b;
--depth: 0;
--z-index-flashes: 100;
--z-index-table-row-outline: 10;
}
*,
::before,
::after {
box-sizing: border-box;
}
::selection {
background-color: var(--color-blue);
color: white;
}
:focus-visible {
outline: none;
}
body {
display: grid;
gap: 0.8em;
grid-template-areas:
"header header header"
"nav nav nav"
"leftside main rightside";
grid-template-columns: 1fr auto 1fr;
grid-template-rows: repeat(3, auto);
font-family: system-ui;
margin: 0.4em;
}
button,
input,
select,
textarea {
background-color: inherit;
font: inherit;
}
input,
select {
text-align: inherit;
}
/* blue - target for interaction with pointer */
/* gray - target for interaction with keyboard */
/* TODO: remove non-font-size rems from buttons/inputs below */
a,
button,
input[type=submit] {
cursor: pointer;
text-decoration: none;
white-space: nowrap;
}
.button,
button,
input[type=submit],
.tab {
align-items: center;
color: var(--color-gray);
display: flex;
fill: var(--color-gray);
font-weight: bold;
}
.button,
button,
input[type=submit] {
font-size: 0.8rem;
padding: 0.4em;
width: fit-content;
}
input:not([type=submit]):not([type=checkbox]),
select,
textarea {
padding: 0.2em 0.4em;
}
.button,
button,
input,
select,
textarea {
border: solid 1px var(--color-gray);
border-radius: 0.25em;
}
textarea {
margin: 0
}
.button > svg,
.tab > svg,
button > svg {
height: 1.8em;
padding-right: 0.4em;
width: 1.8em;
}
/* TODO: move normal non-button links (<a>:hover/:focus) styling here (i.e.
* page-wide, top-level) and remove from table.items - as the style should be
* same everywhere */
.button:focus-visible,
button:focus-visible,
input[type=submit]:focus-visible {
background-color: var(--color-focus-gray);
}
.button:hover,
button:hover,
input[type=submit]:hover {
background-color: var(--color-blue);
border-color: var(--color-blue);
color: white;
fill: white;
}
.dangerous:hover {
background-color: var(--color-red);
border-color: var(--color-red);
}
input[type=checkbox] {
accent-color: var(--color-blue);
appearance: none;
-webkit-appearance: none;
display: flex;
height: 1.1rem;
margin: 0;
width: 1.1rem;
}
input[type=checkbox]:checked {
appearance: checkbox;
-webkit-appearance: checkbox;
}
/* Hide spin buttons in input number fields */
input[type=number] {
-moz-appearance: textfield;
}
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
input::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
input:hover,
select:hover,
textarea:hover {
border-color: var(--color-blue);
outline: solid 1px var(--color-blue);
}
input:invalid,
select:invalid,
textarea:invalid {
border-color: var(--color-red);
outline: solid 1px var(--color-red);
}
select:hover {
cursor: pointer;
}
input:focus-visible,
select:focus-within,
select:focus-visible,
textarea:focus-visible {
accent-color: var(--color-dark-blue);
background-color: var(--color-focus-gray);
}
input[type=text]:read-only,
textarea:read-only {
border: none;
padding-left: 0;
padding-right: 0;
}
.header {
display: flex;
gap: 0.8em;
grid-area: header;
}
.navigation {
display: flex;
grid-area: nav;
}
.navigation > .tab + .tab.right {
margin-inline-start: 4%;
}
.navigation > .tab {
border-bottom: solid 2px var(--color-nav-gray);
flex: 1;
font-size: 1rem;
justify-content: center;
padding-block: 0.3em;
}
.navigation > .tab:hover,
.navigation > .tab:focus-visible {
background-color: var(--color-focus-gray);
}
.navigation > .tab.active {
border-bottom: solid 4px var(--color-blue);
color: var(--color-blue);
fill: var(--color-blue);
}
.leftside {
grid-area: leftside;
}
.main {
grid-area: main;
}
.rightside {
grid-area: rightside;
}
#flashes {
display: grid;
gap: 0.2em;
grid-template-columns: 1fr auto auto auto 1fr;
left: 0;
pointer-events: none;
position: fixed;
right: 0;
top: 0.4em;
z-index: var(--z-index-flashes);
}
.flash {
align-items: center;
border-radius: 0.2em;
color: white;
display: grid;
grid-column: 2/5;
grid-template-columns: subgrid;
pointer-events: auto;
}
.flash.alert:before {
content: url('pictograms/alert-outline.svg');
height: 1.4em;
margin: 0 0.5em;
width: 1.4em;
}
.flash.alert {
border-color: var(--color-red);
background-color: var(--color-red);
}
.flash.notice:before {
content: url('pictograms/check-circle-outline.svg');
height: 1.4em;
margin: 0 0.5em;
width: 1.4em;
}
.flash.notice {
border-color: var(--color-blue);
background-color: var(--color-blue);
}
.flash > div {
grid-column: 2;
}
/* NOTE: currently flash button inherits some unnecessary styles from generic
* button. */
.flash > button {
border: none;
color: inherit;
cursor: pointer;
font-size: 1.4em;
font-weight: bold;
grid-column: 3;
opacity: 0.6;
padding: 0.2em 0.4em;
}
.flash > button:hover {
opacity: 1;
}
/* TODO: Update styling, including rem removal. */
form table {
border-spacing: 0.8rem;
}
form tr td:first-child {
color: var(--color-gray);
font-size: 0.9rem;
padding-right: 0.25rem;
text-align: right;
}
form label.required {
font-weight: bold;
}
form label.error,
form td.error::after {
color: var(--color-red);
}
form td.error {
display: -webkit-box;
}
form td.error::after {
content: attr(data-content);
font-size: 0.9rem;
margin-left: 1rem;
padding: 0.25rem 0;
position: absolute;
}
form em {
color: var(--color-text-gray);
font-size: 0.75rem;
font-weight: normal;
}
form input[type=submit] {
float: none;
font-size: 1rem;
margin: 1.5rem auto 0 auto;
padding: 0.75rem;
}
table.items {
border-spacing: 0;
border: solid 1px var(--color-border-gray);
border-radius: 0.25em;
font-size: 0.85rem;
text-align: left;
}
table.items thead {
font-size: 0.8rem;
}
table.items thead,
table.items tbody tr:hover {
background-color: var(--color-focus-gray);
}
table.items th {
padding-block: 0.75em;
text-align: center;
}
table.items th,
table.items td {
padding-inline: 1em 0;
}
/* For <a> to fill <td> completely, we use an ::after pseudoelement. */
table.items td.link {
padding: 0;
position: relative;
}
table.items td.link a {
color: inherit;
font: inherit;
}
table.items td.link a::after {
content: '';
inset: 0;
position: absolute;
}
table.items td:first-child {
padding-inline-start: calc(1em + var(--depth) * 0.8em);
}
table.items td:has(input, textarea) {
padding-inline-start: calc(0.6em - 0.9px);
}
table.items td:first-child:has(input, textarea) {
padding-inline-start: calc(0.6em + var(--depth) * 0.8em - 0.9px);
}
table.items th:last-child {
padding-inline-end: 0.4em;
}
table.items td:last-child {
padding-inline-end: 0.1em;
}
table.items td {
border-top: solid 1px var(--color-border-gray);
height: 2.4em;
padding-block: 0.1em;
}
table.items td.actions {
align-items: center;
display: flex;
gap: 0.4em;
justify-content: end;
}
table.items tr.dropzone {
position: relative;
}
table.items tr.dropzone::after {
content: '';
inset: 1px 0 0 0;
position: absolute;
outline: dashed 2px var(--color-blue);
outline-offset: -1px;
z-index: var(--z-index-table-row-outline);
}
table.items td.handle {
cursor: move;
}
table.items tr.form td {
vertical-align: top;
}
/* TODO: replace :hover:focus-visible combos with proper LOVE stye order */
/* TODO: Update styling, including rem removal. */
table.items td.link a:hover,
table.items td.link a:focus-visible,
table.items td.link a:hover:focus-visible {
text-decoration: underline;
text-decoration-thickness: 0.05rem;
text-underline-offset: 0.2rem;
}
table.items td.link a:hover {
color: var(--color-blue);
}
table.items td.link a:focus-visible {
text-decoration-color: var(--color-gray);
}
table.items td.link a:hover:focus-visible {
color: var(--color-dark-blue);
}
table.items td:not(:first-child),
.grayed {
color: var(--color-table-gray);
fill: var(--color-table-gray);
}
table.items td.hint {
color: var(--color-table-gray);
font-style: italic;
font-size: 0.8rem;
padding: 1em;
}
table.items svg {
height: 1.2rem;
vertical-align: middle;
width: 1.2rem;
}
table.items td.number {
text-align: right;
}
table.items .button,
table.items button,
table.items input[type=submit] {
font-weight: normal;
padding: 0.3em;
}
table.items input:not([type=submit]):not([type=checkbox]),
table.items select,
table.items textarea {
padding-block: 0.375em;
}
/* TODO: find a way (layers?) to style inputs differently while making sure
* hover works properly without using :not(:hover) selectors here. */
table.items .button:not(:hover),
table.items button:not(:hover),
table.items input:not(:hover),
table.items select:not(:hover),
table.items textarea:not(:hover) {
border-color: var(--color-border-gray);
}
table.items .button:not(:hover),
table.items button:not(:hover),
table.items input[type=submit]:not(:hover),
table.items select:not(:hover) {
color: var(--color-table-gray);
}
table.items select:focus-within,
table.items select:focus-visible {
color: black;
}
.centered {
margin: 0 auto;
}
.extendedright {
margin-right: auto;
}
[disabled] {
border-color: var(--color-border-gray) !important;
color: var(--color-border-gray) !important;
cursor: not-allowed;
fill: var(--color-border-gray) !important;
pointer-events: none;
}
.unwrappable {
white-space: nowrap;
}
.buttongrid {
display: grid;
gap: 0.4em;
grid-template-areas: "context empty tools";
grid-template-columns: auto 1fr auto;
grid-template-rows: max-content;
}
.tools {
grid-area: tools;
}