/* 1️⃣ CSS Reset - Ensures consistent styling across different browsers */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 2️⃣ Global Variables - Define common colors, typography, and transition speed */
:root {
--primary-color: #007bff;
--secondary-color: #6c757d;
--background-color: #f8f9fa;
--text-color: #333;
--border-color: #ddd;
--shadow-color: rgba(0, 0, 0, 0.1);
--font-family: 'Arial', sans-serif;
--transition-speed: 0.3s;
--focus-color: #ffb703;
}
/* 3️⃣ Dark Mode Support - Automatically adapts to the user's system settings */
@media (prefers-color-scheme: dark) {
:root {
--background-color: #181818;
--text-color: #e0e0e0;
--border-color: #444;
--shadow-color: rgba(0, 0, 0, 0.5);
}
button {
background-color: var(--secondary-color);
}
button:hover {
background-color: var(--primary-color);
}
}
/* 4️⃣ Base Styles - Apply global settings for text and layout */
html,
body {
height: 100%;
font-size: 16px;
line-height: 1.6;
font-family: var(--font-family);
color: var(--text-color);
background-color: var(--background-color);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
scroll-behavior: smooth;
}
/* 5️⃣ Link Styles - Improve readability and add smooth transitions */
a {
color: var(--primary-color);
text-decoration: none;
transition: color var(--transition-speed);
}
a:hover {
color: var(--secondary-color);
text-decoration: underline;
}
/* Focus Styles - for Accessibility */
a:focus,
button:focus {
outline: 2px solid var(--focus-color);
outline-offset: 2px;
}
/* 6️⃣ Button Styles - Ensures consistency across all buttons */
button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 10px 15px;
font-size: 1rem;
cursor: pointer;
transition: background-color var(--transition-speed);
border-radius: 5px;
}
button:hover {
background-color: var(--secondary-color);
}
/* 7️⃣ Image Styles - Ensures images do not exceed their container */
img {
max-width: 100%;
height: auto;
display: block;
}
/* 8️⃣ Layout Container - Centers content and limits maximum width */
.container {
max-width: 1400px;
margin: 0 auto;
padding: 0 20px;
width: 100%;
}
/* 9️⃣ Responsive Design - Adjustments for smaller screens */
@media (max-width: 768px) {
body {
font-size: 14px;
}
.container {
padding: 0 10px;
}
}
/* 1️⃣0️⃣ Extra Small Screens - Further padding adjustments for mobile devices */
@media (max-width: 480px) {
.container {
padding: 0 5px;
}
}