Use fluid scale custom properties and make everything mobile friendly

This commit is contained in:
thiloho
2024-08-15 16:26:32 +02:00
parent 3eb05da564
commit 2a1ada1c70
11 changed files with 244 additions and 80 deletions

View File

@@ -12,6 +12,40 @@
--border-primary: 0.0625rem solid var(--bg-tertiary);
--border-radius: 0.125rem;
/* Step -1: 14.9953px → 14.9953px */
--font-size--1: clamp(0.9372rem, 0.9372rem + 0cqi, 0.9372rem);
/* Step 0: 16px → 16px */
--font-size-0: clamp(1rem, 1rem + 0cqi, 1rem);
/* Step 1: 17.072px → 17.072px */
--font-size-1: clamp(1.067rem, 1.067rem + 0cqi, 1.067rem);
/* Step 2: 18.2158px → 18.2158px */
--font-size-2: clamp(1.1385rem, 1.1385rem + 0cqi, 1.1385rem);
/* Step 3: 19.4363px → 19.4363px */
--font-size-3: clamp(1.2148rem, 1.2148rem + 0cqi, 1.2148rem);
/* Step 4: 20.7385px → 20.7385px */
--font-size-4: clamp(1.2962rem, 1.2962rem + 0cqi, 1.2962rem);
/* Step 5: 22.128px → 22.128px */
--font-size-5: clamp(1.383rem, 1.383rem + 0cqi, 1.383rem);
/* Space 3xs: 4px → 5px */
--space-3xs: clamp(0.25rem, 0.2336rem + 0.0822cqi, 0.3125rem);
/* Space 2xs: 8px → 10px */
--space-2xs: clamp(0.5rem, 0.4671rem + 0.1645cqi, 0.625rem);
/* Space xs: 12px → 15px */
--space-xs: clamp(0.75rem, 0.7007rem + 0.2467cqi, 0.9375rem);
/* Space s: 16px → 20px */
--space-s: clamp(1rem, 0.9342rem + 0.3289cqi, 1.25rem);
/* Space m: 24px → 30px */
--space-m: clamp(1.5rem, 1.4013rem + 0.4934cqi, 1.875rem);
/* Space l: 32px → 40px */
--space-l: clamp(2rem, 1.8684rem + 0.6579cqi, 2.5rem);
/* Space xl: 48px → 60px */
--space-xl: clamp(3rem, 2.8026rem + 0.9868cqi, 3.75rem);
/* Space 2xl: 64px → 80px */
--space-2xl: clamp(4rem, 3.7368rem + 1.3158cqi, 5rem);
/* Space 3xl: 96px → 120px */
--space-3xl: clamp(6rem, 5.6053rem + 1.9737cqi, 7.5rem);
color-scheme: light;
}
@@ -51,11 +85,11 @@ body {
section {
display: flex;
flex-direction: column;
gap: 1rem;
gap: var(--space-s);
}
section + section {
margin-block-start: 2rem;
margin-block-start: var(--space-l);
}
button,
@@ -63,7 +97,8 @@ label,
select,
summary,
[role="button"],
[role="option"] {
[role="option"],
label[for="toggle-mobile-preview"] {
cursor: pointer;
}
@@ -71,13 +106,14 @@ input,
button,
textarea,
select,
a[role="button"] {
a[role="button"],
label[for="toggle-mobile-preview"] {
font: inherit;
color: inherit;
border: var(--border-primary);
border-radius: var(--border-radius);
padding-inline: 0.5rem;
padding-block: 0.25rem;
padding-inline: var(--space-2xs);
padding-block: var(--space-3xs);
}
input,
@@ -90,6 +126,10 @@ textarea {
resize: vertical;
}
input[type="file"] {
inline-size: 100%;
}
a {
color: var(--color-accent);
}
@@ -101,14 +141,21 @@ a[role="button"] {
}
button,
a[role="button"] {
a[role="button"],
label[for="toggle-mobile-preview"] {
background-color: var(--bg-secondary);
}
:is(button, a[role="button"]):hover {
:is(button, a[role="button"], label[for="toggle-mobile-preview"]):hover {
background-color: var(--bg-tertiary);
}
:is(a, button, input, textarea, select):focus,
#toggle-mobile-preview:checked + label {
outline: 0.125rem solid var(--color-accent);
outline-offset: 0.25rem;
}
img,
picture,
svg,
@@ -132,18 +179,29 @@ h6 {
overflow-wrap: break-word;
}
h1,
h2,
h3,
h6 {
font-size: var(--font-size-0);
}
h5 {
font-size: var(--font-size-1);
}
h4 {
line-height: 1.2;
text-wrap: balance;
font-size: var(--font-size-2);
}
h3 {
font-size: var(--font-size-3);
}
h2 {
font-size: var(--font-size-4);
}
h1 {
font-size: var(--font-size-5);
}
form[method="POST"] {
display: flex;
flex-direction: column;
gap: 1rem;
gap: var(--space-s);
}
form > button[type="submit"] {
@@ -152,7 +210,7 @@ form > button[type="submit"] {
form[method="GET"] {
display: grid;
gap: 1rem;
gap: var(--space-s);
grid-template-columns: repeat(auto-fit, minmax(min(100%, 20ch), 1fr));
align-items: start;
}
@@ -164,7 +222,7 @@ form[method="GET"] > button[type="submit"] {
form label {
display: flex;
flex-direction: column;
gap: 0.25rem;
gap: var(--space-2xs);
max-inline-size: 30ch;
}
@@ -175,6 +233,6 @@ form label:has(textarea) {
form .file-field {
display: flex;
align-items: end;
gap: 0.5rem;
gap: var(--space-2xs);
flex-wrap: wrap;
}