Compare commits

...

4 commits

Author SHA1 Message Date
002e945bbe
feat: Optimize the cyber score slider to fit better on mobile 2024-11-17 08:15:40 +01:00
6128fbacd6
feat: The radio group is now actually usable on mobile
- The labels aren't cut off anymore
- Instead of trying to fit four buttons next to each other they're now one each line when not enough room is there
2024-11-17 08:15:18 +01:00
81312824e4
feat: Inherit font size for buttons and input 2024-11-17 08:14:06 +01:00
c86c5fcf98
feat: Add dynamic spacing variables
- Use dynamic spacing for main element and sections
- Fix wonky padding when opening and closing faq answers
2024-11-17 08:13:34 +01:00
2 changed files with 36 additions and 21 deletions

View file

@ -1,5 +1,5 @@
@font-face { @font-face {
/* /*
Note: The font files are not included in this repository due to legal restrictions. Note: The font files are not included in this repository due to legal restrictions.
For more information, please refer to the README.md file located in the 'fonts' directory. For more information, please refer to the README.md file located in the 'fonts' directory.
*/ */
@ -10,6 +10,7 @@
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
} }
:root { :root {
--cyber-bg-color: #05130f; --cyber-bg-color: #05130f;
--cyber-font-color: #e8f0f2; --cyber-font-color: #e8f0f2;
@ -20,6 +21,10 @@
--cyber-hero-overlay: rgba(0, 0, 0, 0.7); --cyber-hero-overlay: rgba(0, 0, 0, 0.7);
--cyber-shadow: rgba(0, 0, 0, 0.5); --cyber-shadow: rgba(0, 0, 0, 0.5);
--cyber-slider-thumb-bg: #fff; --cyber-slider-thumb-bg: #fff;
/* Spacing */
--spacing-sm: clamp(0.75rem, 0.4295rem + 1.3675vw, 1.25rem);; /* 12px to 20px */
--spacing-md: clamp(1.5rem, 1.1795rem + 1.3675vw, 2rem);; /* 16px to 32px */
} }
/* General Styles */ /* General Styles */
@ -79,14 +84,14 @@ h1 {
/* Main content */ /* Main content */
main { main {
padding: 40px 20px; padding-inline: var(--spacing-sm);
max-width: 1000px; max-width: 1000px;
margin: 0 auto; margin: 0 auto;
} }
.form-section { .form-section {
background-color: #102f2a; background-color: #102f2a;
padding: 30px; padding: var(--spacing-md);
border-radius: 10px; border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
margin-bottom: 40px; margin-bottom: 40px;
@ -100,7 +105,9 @@ main {
input[type="text"] { input[type="text"] {
font-family: 'Departure Mono'; font-family: 'Departure Mono';
width: calc(100% - 20px); font-size: inherit;
line-height: 1.35;
width: 100%;
padding: 10px; padding: 10px;
border: 2px solid var(--cyber-primary-color); border: 2px solid var(--cyber-primary-color);
border-radius: 5px; border-radius: 5px;
@ -117,9 +124,14 @@ input[type="text"]:focus {
/* Radio Buttons */ /* Radio Buttons */
.radio-group { .radio-group {
display: flex; display: flex;
justify-content: space-around; flex-direction: column;
justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
gap: var(--spacing-sm);
@media (width > 768px) {
flex-direction: row;
}
} }
.radio-group input[type="radio"] { .radio-group input[type="radio"] {
@ -127,8 +139,7 @@ input[type="text"]:focus {
} }
.radio-group label { .radio-group label {
width: calc(25% - 10px); flex: 1;
margin: 5px;
padding: 10px; padding: 10px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
@ -152,11 +163,12 @@ input[type="text"]:focus {
/* Buttons */ /* Buttons */
button { button {
font-family: 'Departure Mono'; font-family: 'Departure Mono';
font-size: inherit;
line-height: 1.35;
padding: 10px 20px; padding: 10px 20px;
border-radius: 5px; border-radius: 5px;
background-color: var(--cyber-bg-color); background-color: var(--cyber-bg-color);
color: var(--cyber-font-color); color: var(--cyber-font-color);
font-size: 1rem;
cursor: pointer; cursor: pointer;
border: 2px solid transparent; border: 2px solid transparent;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
@ -208,7 +220,7 @@ button:active {
/* FAQ Section */ /* FAQ Section */
.faq-section { .faq-section {
background-color: var(--cyber-faq-bg-color); background-color: var(--cyber-faq-bg-color);
padding: 30px; padding: var(--spacing-md);
border-radius: 10px; border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
color: var(--cyber-font-color); color: var(--cyber-font-color);
@ -243,12 +255,12 @@ button:active {
display: block; display: block;
font-weight: bold; font-weight: bold;
color: var(--cyber-highlight-color); color: var(--cyber-highlight-color);
padding: 15px; padding: var(--spacing-sm);
background-color: #102f2a; background-color: #102f2a;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
margin-bottom: 5px; margin-bottom: var(--spacing-sm);
transition: background-color 0.3s; transition: background-color 0.3s;
white-space: normal; white-space: normal;
overflow: visible; overflow: visible;
@ -267,9 +279,9 @@ button:active {
.faq-answer { .faq-answer {
max-height: 0; max-height: 0;
display: none;
overflow: hidden; overflow: hidden;
transition: max-height 0.5s ease; padding: var(--spacing-sm);
padding: 0 15px;
background-color: var(--cyber-bg-color); background-color: var(--cyber-bg-color);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
border-radius: 8px; border-radius: 8px;
@ -278,7 +290,7 @@ button:active {
.faq-checkbox:checked + .faq-question + .faq-answer { .faq-checkbox:checked + .faq-question + .faq-answer {
max-height: 100%; max-height: 100%;
padding: 15px; display: block;
} }
/* List Styles for FAQ */ /* List Styles for FAQ */
.faq-answer ul, .faq-answer ul,
@ -308,7 +320,7 @@ button:active {
/* Credits Section */ /* Credits Section */
.credits-section { .credits-section {
background-color: var(--cyber-faq-bg-color); background-color: var(--cyber-faq-bg-color);
padding: 30px; padding: var(--spacing-md);
border-radius: 10px; border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
color: var(--cyber-font-color); color: var(--cyber-font-color);
@ -431,21 +443,25 @@ button:active {
/* Slider */ /* Slider */
.slider-container { .slider-container {
margin: 20px 0; margin: 20px 0;
text-align: center;
color: var(--cyber-font-color); color: var(--cyber-font-color);
display: flex; display: flex;
flex-wrap: wrap;
align-items: center; align-items: center;
justify-content: center; text-align: center;
gap: 15px; gap: var(--spacing-sm) var(--spacing-md);
} }
.slider-container label { .slider-container label {
font-size: 1.2rem; font-size: 1.2rem;
@media (width < 568px) {
width: 100%;
}
} }
input[type="range"] { input[type="range"] {
-webkit-appearance: none; -webkit-appearance: none;
width: 70%; flex: 1;
margin: 10.5px 0; margin: 10.5px 0;
background-color: var(--cyber-faq-bg-color); background-color: var(--cyber-faq-bg-color);
} }
@ -527,7 +543,6 @@ input[type="range"]::-ms-thumb {
#sliderValueDisplay { #sliderValueDisplay {
font-size: 1.1rem; font-size: 1.1rem;
margin-left: 10px;
color: var(--cyber-primary-color); color: var(--cyber-primary-color);
font-weight: bold; font-weight: bold;
} }
@ -540,4 +555,4 @@ a {
a:hover { a:hover {
text-decoration: none; text-decoration: none;
color: var(--cyber-secondary-color); color: var(--cyber-secondary-color);
} }

Binary file not shown.