Redesign tokens: colors, type, spacing, motion for light and dark
This commit is contained in:
1 parent
8df4c894f1
commit
ebf4922e8a
1 file changed
+231
-124
+231
-124
@@ -1,167 +1,274 @@
|
||||
/* Colors are variables so the theme can follow the phone (prefers-color-scheme) or a manual choice (data-theme). */
|
||||
/*
|
||||
* ParentCalendar design tokens. Components use these, never raw colors.
|
||||
* Light and dark are designed together; every text/background pair is at least 4.5:1 (secondary text at least 4.5:1 too).
|
||||
* The theme follows the device (prefers-color-scheme) unless Settings pins it (data-theme).
|
||||
*/
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--bg: #f6f7f9;
|
||||
/* Surfaces */
|
||||
--bg: #f4f5f9;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #eef1f5;
|
||||
--text: #1c1f24;
|
||||
--muted: #5d6877;
|
||||
--border: #d9dee5;
|
||||
--accent: #2563eb;
|
||||
--accent-soft: #dbe6ff;
|
||||
--on-accent: #ffffff;
|
||||
--warn: #9a5800;
|
||||
--warn-soft: #fff1dc;
|
||||
--danger: #c62828;
|
||||
--danger-soft: #fde7e7;
|
||||
--ok: #1b7f3b;
|
||||
--ok-soft: #e1f5e7;
|
||||
--grey-day: #eceef2;
|
||||
--highlight: rgba(37, 99, 235, 0.22);
|
||||
--shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
|
||||
--surface-2: #f0f1f6;
|
||||
--surface-3: #e6e8f0;
|
||||
--border: #dfe2ea;
|
||||
--border-strong: #c7ccd8;
|
||||
/* Text */
|
||||
--text: #161a23;
|
||||
--text-2: #4f5767; /* 7.4:1 on white */
|
||||
--text-3: #687083; /* 4.9:1 on white, for hints */
|
||||
/* Brand */
|
||||
--primary: #4f46e5; /* 6.3:1 on white */
|
||||
--primary-hover: #4338ca;
|
||||
--primary-soft: #eceafe;
|
||||
--on-primary: #ffffff;
|
||||
--primary-text: #3f37c9; /* links and active nav on light surfaces */
|
||||
/* Status (text on its soft background) */
|
||||
--warn: #92400e; --warn-soft: #fef3c7;
|
||||
--ok: #166534; --ok-soft: #dcfce7;
|
||||
--danger: #b91c1c; --danger-soft: #fee2e2;
|
||||
--info: #3f37c9; --info-soft: #eceafe;
|
||||
/* Misc */
|
||||
--day-closed: #eceef3;
|
||||
--highlight: rgba(79, 70, 229, 0.18);
|
||||
--scrim: rgba(15, 18, 30, 0.5);
|
||||
--shadow-1: 0 1px 2px rgba(22, 26, 35, 0.06), 0 1px 1px rgba(22, 26, 35, 0.04);
|
||||
--shadow-2: 0 4px 12px rgba(22, 26, 35, 0.08), 0 1px 3px rgba(22, 26, 35, 0.06);
|
||||
--shadow-3: 0 12px 32px rgba(22, 26, 35, 0.14);
|
||||
|
||||
/* Spacing: 4pt scale */
|
||||
--s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
|
||||
/* Type scale */
|
||||
--fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;
|
||||
/* Shape */
|
||||
--r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
|
||||
/* Motion */
|
||||
--dur: 160ms; --dur-out: 110ms; --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
/* Layers */
|
||||
--z-sticky: 10; --z-nav: 20; --z-toast: 40;
|
||||
/* Layout */
|
||||
--nav-h: 64px; --rail-w: 88px; --gutter: 16px;
|
||||
|
||||
--font: 'Plus Jakarta Sans Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme='light']) {
|
||||
color-scheme: dark;
|
||||
--bg: #14171c;
|
||||
--surface: #1d2128;
|
||||
--surface-2: #262b34;
|
||||
--text: #e8ebf0;
|
||||
--muted: #9aa4b2;
|
||||
--border: #353b46;
|
||||
--accent: #6b9bff;
|
||||
--accent-soft: #233456;
|
||||
--on-accent: #0d1424;
|
||||
--warn: #f0b45c;
|
||||
--warn-soft: #3a2c15;
|
||||
--danger: #ff8a80;
|
||||
--danger-soft: #3d2020;
|
||||
--ok: #7fd49a;
|
||||
--ok-soft: #1d3527;
|
||||
--grey-day: #22262e;
|
||||
--highlight: rgba(107, 155, 255, 0.3);
|
||||
--shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
|
||||
--bg: #0e1015;
|
||||
--surface: #171a21;
|
||||
--surface-2: #1e222b;
|
||||
--surface-3: #272c37;
|
||||
--border: #2c313d;
|
||||
--border-strong: #3d4453;
|
||||
--text: #eceef3;
|
||||
--text-2: #b4bac6;
|
||||
--text-3: #959cab;
|
||||
--primary: #8b93ff;
|
||||
--primary-hover: #a3a9ff;
|
||||
--primary-soft: #23264a;
|
||||
--on-primary: #10123a;
|
||||
--primary-text: #a9afff;
|
||||
--warn: #fcd34d; --warn-soft: #33270f;
|
||||
--ok: #86efac; --ok-soft: #10291a;
|
||||
--danger: #fca5a5; --danger-soft: #331717;
|
||||
--info: #a9afff; --info-soft: #23264a;
|
||||
--day-closed: #1b1e26;
|
||||
--highlight: rgba(139, 147, 255, 0.24);
|
||||
--scrim: rgba(0, 0, 0, 0.6);
|
||||
--shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
|
||||
--shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
|
||||
--shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
color-scheme: dark;
|
||||
--bg: #14171c;
|
||||
--surface: #1d2128;
|
||||
--surface-2: #262b34;
|
||||
--text: #e8ebf0;
|
||||
--muted: #9aa4b2;
|
||||
--border: #353b46;
|
||||
--accent: #6b9bff;
|
||||
--accent-soft: #233456;
|
||||
--on-accent: #0d1424;
|
||||
--warn: #f0b45c;
|
||||
--warn-soft: #3a2c15;
|
||||
--danger: #ff8a80;
|
||||
--danger-soft: #3d2020;
|
||||
--ok: #7fd49a;
|
||||
--ok-soft: #1d3527;
|
||||
--grey-day: #22262e;
|
||||
--highlight: rgba(107, 155, 255, 0.3);
|
||||
--shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
|
||||
--bg: #0e1015;
|
||||
--surface: #171a21;
|
||||
--surface-2: #1e222b;
|
||||
--surface-3: #272c37;
|
||||
--border: #2c313d;
|
||||
--border-strong: #3d4453;
|
||||
--text: #eceef3;
|
||||
--text-2: #b4bac6;
|
||||
--text-3: #959cab;
|
||||
--primary: #8b93ff;
|
||||
--primary-hover: #a3a9ff;
|
||||
--primary-soft: #23264a;
|
||||
--on-primary: #10123a;
|
||||
--primary-text: #a9afff;
|
||||
--warn: #fcd34d; --warn-soft: #33270f;
|
||||
--ok: #86efac; --ok-soft: #10291a;
|
||||
--danger: #fca5a5; --danger-soft: #331717;
|
||||
--info: #a9afff; --info-soft: #23264a;
|
||||
--day-closed: #1b1e26;
|
||||
--highlight: rgba(139, 147, 255, 0.24);
|
||||
--scrim: rgba(0, 0, 0, 0.6);
|
||||
--shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
|
||||
--shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
|
||||
--shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
@media (min-width: 768px) { :root { --gutter: 24px; } }
|
||||
@media (min-width: 1024px) { :root { --gutter: 32px; } }
|
||||
|
||||
html, body {
|
||||
/* ---------- Base ---------- */
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
|
||||
html { -webkit-text-size-adjust: 100%; }
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100dvh;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
font: 400 var(--fs-md)/1.5 var(--font);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
|
||||
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
|
||||
h1 { font-size: var(--fs-2xl); font-weight: 750; }
|
||||
h2 { font-size: var(--fs-lg); font-weight: 700; }
|
||||
h3 { font-size: var(--fs-md); font-weight: 700; }
|
||||
p { margin: 0; }
|
||||
a { color: var(--primary-text); text-underline-offset: 3px; }
|
||||
ul { margin: 0; padding: 0; list-style: none; }
|
||||
img { max-width: 100%; }
|
||||
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
|
||||
legend { padding: 0; }
|
||||
|
||||
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
|
||||
|
||||
.skip-link {
|
||||
position: absolute; left: var(--s2); top: -100px; z-index: var(--z-toast);
|
||||
background: var(--primary); color: var(--on-primary); padding: var(--s2) var(--s4); border-radius: var(--r-md);
|
||||
}
|
||||
.skip-link:focus { top: var(--s2); }
|
||||
.visually-hidden {
|
||||
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
|
||||
}
|
||||
|
||||
h1 { font-size: 1.5rem; margin: 4px 0 16px; }
|
||||
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
|
||||
h3 { font-size: 1rem; margin: 16px 0 8px; }
|
||||
a { color: var(--accent); }
|
||||
p { margin: 8px 0; }
|
||||
.muted { color: var(--muted); }
|
||||
.small { font-size: 0.875rem; }
|
||||
/* ---------- Layout helpers ---------- */
|
||||
.stack { display: flex; flex-direction: column; gap: var(--s3); }
|
||||
.stack-lg { display: flex; flex-direction: column; gap: var(--s5); }
|
||||
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
|
||||
.spread { justify-content: space-between; }
|
||||
.grow { flex: 1 1 auto; min-width: 0; }
|
||||
.section { display: flex; flex-direction: column; gap: var(--s3); }
|
||||
.section-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 700;
|
||||
text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
|
||||
.section-title .count { font-weight: 600; color: var(--text-3); letter-spacing: 0; text-transform: none; }
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 12px 16px;
|
||||
box-shadow: var(--shadow);
|
||||
border-radius: var(--r-lg);
|
||||
padding: var(--s4);
|
||||
box-shadow: var(--shadow-1);
|
||||
}
|
||||
.stack > * + * { margin-top: 12px; }
|
||||
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.spread { justify-content: space-between; }
|
||||
.grow { flex: 1; }
|
||||
.card-list { display: flex; flex-direction: column; gap: var(--s2); }
|
||||
|
||||
/* Touch targets are at least 44px. */
|
||||
button, .button, select, input, textarea {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
min-height: 44px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
button, .button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid var(--border);
|
||||
/* ---------- Text ---------- */
|
||||
.muted { color: var(--text-2); }
|
||||
.hint { color: var(--text-3); font-size: var(--fs-sm); }
|
||||
.small { font-size: var(--fs-sm); }
|
||||
.strong { font-weight: 650; }
|
||||
.tabular { font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* ---------- Buttons ---------- */
|
||||
button, .btn {
|
||||
font: inherit; color: inherit;
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
|
||||
min-height: 44px; padding: 0 var(--s4);
|
||||
border-radius: var(--r-md);
|
||||
border: 1px solid var(--border-strong);
|
||||
background: var(--surface);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
font-weight: 600; font-size: var(--fs-sm);
|
||||
text-decoration: none; cursor: pointer; white-space: nowrap;
|
||||
transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
|
||||
transform var(--dur-out) var(--ease), box-shadow var(--dur) var(--ease);
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
button:disabled { opacity: 0.5; cursor: default; }
|
||||
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
|
||||
button.danger { color: var(--danger); border-color: var(--danger); }
|
||||
button.quiet { border-color: transparent; background: transparent; }
|
||||
button.small { min-height: 36px; padding: 0 10px; font-size: 0.875rem; }
|
||||
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
|
||||
outline: 3px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
button:hover:not(:disabled), .btn:hover { background: var(--surface-2); }
|
||||
button:active:not(:disabled), .btn:active { transform: scale(0.97); }
|
||||
button:disabled { opacity: 0.45; cursor: not-allowed; }
|
||||
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-1); }
|
||||
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
|
||||
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
|
||||
button.danger.solid { background: var(--danger); color: var(--surface); border-color: var(--danger); }
|
||||
button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
|
||||
button.ghost:hover:not(:disabled), .btn.ghost:hover { background: var(--surface-2); }
|
||||
/* .sm is visually compact but keeps the full 44px tap target */
|
||||
button.sm, .btn.sm { min-height: 44px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
|
||||
button.lg, .btn.lg { min-height: 56px; padding: 0 var(--s5); font-size: var(--fs-md); border-radius: var(--r-lg); }
|
||||
button.block, .btn.block { width: 100%; }
|
||||
button.icon { padding: 0; width: 44px; }
|
||||
button[aria-pressed='true'] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
|
||||
|
||||
/* ---------- Forms ---------- */
|
||||
input, select, textarea {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
font: inherit; color: var(--text);
|
||||
width: 100%; min-height: 44px; padding: var(--s2) var(--s3);
|
||||
border: 1px solid var(--border-strong); border-radius: var(--r-md);
|
||||
background: var(--surface);
|
||||
transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
|
||||
}
|
||||
input[type='checkbox'], input[type='radio'] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
|
||||
input[type='color'] { padding: 2px; width: 56px; }
|
||||
textarea { min-height: 88px; }
|
||||
label { display: block; font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; }
|
||||
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1rem; min-height: 44px; margin: 0; }
|
||||
.field { margin-bottom: 12px; }
|
||||
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
|
||||
input:focus-visible, select:focus-visible, textarea:focus-visible {
|
||||
outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--highlight);
|
||||
}
|
||||
input[type='checkbox'], input[type='radio'] { width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--primary); flex: none; }
|
||||
input[type='color'] { padding: 4px; width: 52px; flex: none; cursor: pointer; }
|
||||
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
|
||||
.label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin-bottom: var(--s1); }
|
||||
.field { display: flex; flex-direction: column; gap: var(--s1); }
|
||||
.field .label { margin: 0; }
|
||||
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); }
|
||||
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer; font-weight: 500; color: var(--text); }
|
||||
.chip-check {
|
||||
display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3);
|
||||
border: 1px solid var(--border-strong); border-radius: var(--r-full); cursor: pointer; font-size: var(--fs-sm); font-weight: 600;
|
||||
transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
|
||||
}
|
||||
.chip-check:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
|
||||
.chip-check input { width: 16px; height: 16px; min-height: 16px; }
|
||||
|
||||
/* ---------- Badges, dots, chips ---------- */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
background: var(--surface-2);
|
||||
color: var(--muted);
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
padding: 2px var(--s2); border-radius: var(--r-full);
|
||||
font-size: var(--fs-xs); font-weight: 650; line-height: 1.6;
|
||||
background: var(--surface-2); color: var(--text-2);
|
||||
}
|
||||
.badge.warn { background: var(--warn-soft); color: var(--warn); }
|
||||
.badge.ok { background: var(--ok-soft); color: var(--ok); }
|
||||
.badge.danger { background: var(--danger-soft); color: var(--danger); }
|
||||
.badge.info { background: var(--accent-soft); color: var(--accent); }
|
||||
|
||||
.badge.info { background: var(--info-soft); color: var(--info); }
|
||||
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
|
||||
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
|
||||
.error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 10px; }
|
||||
|
||||
/* ---------- Feedback ---------- */
|
||||
.alert {
|
||||
display: flex; gap: var(--s2); align-items: flex-start;
|
||||
padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: var(--fs-sm);
|
||||
}
|
||||
.alert.error { background: var(--danger-soft); color: var(--danger); }
|
||||
.alert.info { background: var(--info-soft); color: var(--info); }
|
||||
.alert.warn { background: var(--warn-soft); color: var(--warn); }
|
||||
|
||||
.skeleton {
|
||||
border-radius: var(--r-lg);
|
||||
background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.4s ease-in-out infinite;
|
||||
}
|
||||
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
|
||||
|
||||
.spin { animation: spin 0.9s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
|
||||
.skeleton { animation: none; }
|
||||
.spin { animation: spin 3s linear infinite !important; animation-iteration-count: infinite !important; }
|
||||
}
|
||||
Reference in new issue
Block a user