Files
myep/assets/styles/ep-design.css
T

317 lines
9.5 KiB
CSS

/*
* E&P corporate design for the internal Symfony tools, taken from the E&P apps template (Gitea EP/apps,
* frontend/app/globals.css, frontend/components/): Lato, deep blue as the brand colour, magenta only
* for the one main action of a page, square shapes, light blue page.
* Status colours (green, red, amber) always come with text, never alone.
*
* Import after Tailwind: @import "tailwindcss"; @import "./ep-design.css"; @plugin "@tailwindcss/forms";
* The toast styles expect toastify-js (@import "toastify-js/src/toastify.css" before this file).
*/
/*
* Lato (OFL) ships with the app, so browsers load nothing from Google: 400 (and italic), 700, 900. No 600:
* font-semibold renders as 700, like font-bold; font-black is 900. The weights are not remapped.
*/
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400-italic.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("../fonts/lato-700.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("../fonts/lato-900.woff2") format("woff2");
}
@theme {
--font-sans: "Lato", ui-sans-serif, system-ui, sans-serif;
/* square everywhere; rounded-full stays round. Plain `rounded` reads --radius. */
--radius: 0px;
--radius-xs: 0px;
--radius-sm: 0px;
--radius-md: 0px;
--radius-lg: 0px;
--radius-xl: 0px;
--radius-2xl: 0px;
--radius-3xl: 0px;
--radius-4xl: 0px;
--color-brand: #18527b; /* E&P deep blue, 8.5:1 on white */
--color-brand-dark: #103c5b;
--color-brand-mid: #165883;
--color-brand-bright: #009fff; /* underlines and focus, never text */
--color-brand-light: #e3eef8;
--color-page: #ebf3fa; /* page background */
--color-line: #d8e3ed; /* borders */
--color-ink: #27272a; /* text */
--color-muted: #52525b; /* secondary text, 7.7:1 on white */
--color-accent: #c4097c; /* magenta of the main action */
--color-accent-from: #960167;
--color-accent-to: #fa1a8c;
}
/*
* Tailwind 3 defaults that Tailwind 4 changed: borders were a light gray instead of currentColor,
* and buttons had a pointer cursor.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-line, currentcolor);
}
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
/* modals: centred (Preflight resets the browser's margin: auto), the page behind dimmed and blurred */
dialog:modal {
margin: auto;
max-height: 85vh;
}
dialog::backdrop {
background: rgb(39 39 42 / 0.35);
backdrop-filter: blur(3px);
}
/* visible keyboard focus everywhere (WCAG 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
outline: 3px solid var(--color-brand-bright);
outline-offset: 2px;
}
}
/*
* Components as in the apps template (frontend/components/ui.ts, Field.tsx, Alert.tsx). Magenta
* only for the one main action of a page.
*/
@layer components {
.btn,
.btn-primary,
.btn-secondary {
@apply inline-flex items-center justify-center gap-2 px-4 py-2.5 text-xs font-bold uppercase tracking-wide no-underline transition-colors disabled:cursor-not-allowed;
}
.btn-primary {
@apply text-white;
background-image: linear-gradient(120deg, var(--color-accent-from), #9e036a 40%, var(--color-accent-to));
}
.btn-primary:hover {
background-image: linear-gradient(120deg, #7d0156, #8a035d 40%, #e3107c);
}
.btn-primary:disabled {
background-image: none;
background-color: #64748b;
}
.btn-secondary {
@apply border border-brand bg-white text-brand hover:bg-brand hover:text-white;
}
/* small actions in toolbars and on cards, next to the one main action */
.btn-tool {
@apply inline-flex items-center gap-1 rounded border border-line bg-white px-2 py-1 text-sm text-ink hover:border-brand hover:text-brand disabled:cursor-default disabled:border-line disabled:text-gray-400;
}
/* the "⋯" behind which the actions of a card or row wait (menu_controller.js); finger-sized on touch screens */
.btn-more {
@apply inline-flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 shrink-0 items-center justify-center rounded text-muted hover:bg-page hover:text-brand aria-expanded:bg-page aria-expanded:text-brand;
}
.menu-panel {
@apply fixed z-40 min-w-48 border border-line bg-white py-1 text-sm shadow-lg;
}
.menu-item {
@apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-ink no-underline hover:bg-page hover:text-brand focus:bg-page;
}
.menu-item-danger {
@apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-red-800 hover:bg-page hover:text-red-900 focus:bg-page;
}
.input {
@apply block w-full border border-slate-500 bg-white px-3 py-2 text-sm text-slate-900 placeholder:text-slate-500 focus:border-brand-bright aria-[invalid=true]:border-red-700 aria-[invalid=true]:ring-1 aria-[invalid=true]:ring-red-700 disabled:bg-slate-100 disabled:text-slate-600;
}
.field-label {
@apply block text-xs font-bold uppercase tracking-wide text-slate-700;
}
/* white box on the light blue page */
.card {
@apply border border-line bg-white;
}
.section-title {
@apply text-base font-bold uppercase tracking-wide text-brand;
}
/* a row of tabs; the base line is an inset shadow, so a row that scrolls sideways doesn't scroll vertically too */
.tabs {
@apply flex overflow-x-auto shadow-[inset_0_-1px_0_var(--color-line)];
}
.tab {
@apply shrink-0 whitespace-nowrap border-b-4 border-transparent px-3 py-2 text-sm text-ink no-underline hover:text-brand;
}
.tab[aria-current],
.tab[aria-selected="true"] {
@apply border-brand-bright font-bold text-brand;
}
/* the main views as tabs in the header (_partials/_header.html.twig), for apps with few views */
.header-tab {
@apply flex items-center whitespace-nowrap border-b-4 border-transparent px-3 text-ink no-underline hover:text-brand;
}
.header-tab[aria-current] {
@apply border-brand-bright font-bold text-brand;
}
/*
* Sidebar navigation for apps with many views (_partials/_sidebar_menu.html.twig): on the light
* blue page, the current item is a white box.
*/
.sidebar-heading {
@apply px-2 pt-5 pb-1 text-[11px] font-bold uppercase tracking-wide text-muted;
}
.sidebar-link {
@apply flex w-full items-center gap-x-3 p-2 text-left text-sm leading-6 font-bold text-ink no-underline hover:bg-white/60 hover:text-brand;
}
.sidebar-sublink {
@apply block py-2 pr-2 pl-10 text-sm leading-6 text-ink no-underline hover:bg-white/60 hover:text-brand;
}
:is(.sidebar-link, .sidebar-sublink)[aria-current],
.sidebar-link--ancestor {
@apply bg-white text-brand;
}
.sidebar-group > summary {
@apply list-none;
}
.sidebar-group > summary::-webkit-details-marker {
display: none;
}
/* chevron of a group that opens in place */
.sidebar-group > summary::after {
@apply ml-auto size-2 shrink-0 rotate-45 border-r-2 border-b-2 border-current opacity-60 transition-transform content-[''];
}
.sidebar-group[open] > summary::after {
@apply -rotate-135;
}
/* the sidebar as a drawer from the left on small screens (drawer_controller.js) */
dialog.drawer {
@apply m-0 h-dvh max-h-none w-80 max-w-[calc(100vw-4rem)] bg-page p-0;
}
/* lists in a card: the outer cells line up with the card's padding */
.data-table {
@apply w-full;
}
.data-table thead tr {
@apply border-b-2 border-brand text-left text-[11px] font-bold uppercase tracking-wide text-brand;
}
.data-table th {
@apply px-2 py-2;
}
.data-table td {
@apply px-2 py-1.5;
}
.data-table :is(th, td):first-child {
@apply pl-5;
}
.data-table :is(th, td):last-child {
@apply pr-5;
}
.data-table tbody tr {
@apply border-b last:border-b-0;
}
/* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */
.notice {
@apply border-l-4 px-4 py-2;
}
/* toasts (toast_controller.js) in the colours of the notices */
.toastify {
@apply max-w-sm rounded-none border-l-4 bg-none px-4 py-3 text-sm shadow-lg;
}
.toastify--success {
@apply border-emerald-700 bg-emerald-50 text-emerald-950;
}
.toastify--error {
@apply border-red-700 bg-red-50 text-red-950;
}
.toastify--warning {
@apply border-amber-600 bg-amber-50 text-amber-950;
}
.toastify--info {
@apply border-brand bg-brand-light text-ink;
}
.toastify .toast-close {
@apply ml-3 text-current opacity-60 hover:opacity-100;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}