COS498-Group7 / client /src /styles /globals.css
izzicooki's picture
Fix Task 5 code review issues: reconnect backoff, dead code, a11y, and polish
4da3586
/* PC Pal — Elderly-Friendly Global Styles */
/* Designed for maximum readability and ease of use */
:root {
/* Color palette */
--color-bg: #f5f5f5;
--color-text: #1a1a2e;
--color-text-light: #4a4a6a;
--color-primary: #2563eb;
--color-primary-dark: #1d4ed8;
--color-primary-light: #dbeafe;
--color-success: #16a34a;
--color-success-light: #dcfce7;
--color-warning: #d97706;
--color-warning-light: #fef3c7;
--color-danger: #dc2626;
--color-danger-light: #fee2e2;
--color-white: #ffffff;
--color-border: #d1d5db;
--color-surface: #ffffff;
--color-surface-alt: #f0f0f8;
--color-shadow: rgba(26, 26, 46, 0.12);
/* Typography */
--font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
--font-size-base: 18px;
--font-size-sm: 16px;
--font-size-md: 20px;
--font-size-lg: 24px;
--font-size-xl: 30px;
--font-size-2xl: 36px;
--line-height: 1.6;
/* Spacing */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
--spacing-2xl: 48px;
/* Touch targets */
--touch-target: 48px;
/* Border radius */
--radius-sm: 6px;
--radius-md: 12px;
--radius-lg: 18px;
--radius-full: 9999px;
/* Transitions */
--transition: 200ms ease;
}
/* Reset */
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: var(--font-size-base);
-webkit-text-size-adjust: 100%;
}
body {
font-family: var(--font-family);
font-size: var(--font-size-base);
line-height: var(--line-height);
color: var(--color-text);
background-color: var(--color-bg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
min-height: 100vh;
}
#root {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Headings */
h1, h2, h3, h4, h5, h6 {
color: var(--color-text);
line-height: 1.3;
font-weight: 700;
}
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }
p {
margin-bottom: var(--spacing-md);
font-size: var(--font-size-base);
line-height: var(--line-height);
}
/* Large, accessible buttons */
button {
font-family: var(--font-family);
font-size: var(--font-size-md);
font-weight: 600;
min-height: var(--touch-target);
min-width: var(--touch-target);
padding: var(--spacing-sm) var(--spacing-lg);
border: none;
border-radius: var(--radius-md);
cursor: pointer;
transition: background-color var(--transition), transform var(--transition),
box-shadow var(--transition);
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--spacing-sm);
line-height: 1.2;
}
button:focus-visible {
outline: 3px solid var(--color-primary);
outline-offset: 3px;
}
button:active {
transform: scale(0.98);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
/* Primary button */
.btn-primary {
background-color: var(--color-primary);
color: var(--color-white);
}
.btn-primary:hover:not(:disabled) {
background-color: var(--color-primary-dark);
box-shadow: 0 4px 12px var(--color-shadow);
}
/* Secondary button */
.btn-secondary {
background-color: var(--color-white);
color: var(--color-text);
border: 2px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
background-color: var(--color-surface-alt);
border-color: var(--color-primary);
}
/* Large, readable input fields */
input[type="text"],
input[type="email"],
textarea {
font-family: var(--font-family);
font-size: var(--font-size-md);
color: var(--color-text);
background-color: var(--color-white);
border: 2px solid var(--color-border);
border-radius: var(--radius-md);
padding: var(--spacing-md) var(--spacing-lg);
width: 100%;
min-height: var(--touch-target);
transition: border-color var(--transition), box-shadow var(--transition);
line-height: var(--line-height);
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px var(--color-primary-light);
}
input::placeholder,
textarea::placeholder {
color: var(--color-text-light);
opacity: 0.8;
}
/* Links */
a {
color: var(--color-primary);
text-decoration: underline;
}
a:hover {
color: var(--color-primary-dark);
}
/* Utilities */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* Animations — smooth, non-jarring */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
animation: fadeIn 300ms ease forwards;
}
.animate-slide-up {
animation: slideUp 350ms ease forwards;
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}