style: refactor layout and replace fixed spacing with font-relative units
This commit is contained in:
+96
-71
@@ -12,15 +12,11 @@
|
||||
--color-theme-header: ;
|
||||
--list-theme-marker: "►";
|
||||
--font-theme-size: 1rem;
|
||||
--line-theme-height: 1.54em;
|
||||
--line-theme-height: calc(var(--font-theme-size) * 1.54);
|
||||
--radius-theme-default: 0;
|
||||
--font-theme-default: 'JetBrains Mono';
|
||||
--font-theme-fallback: Monaco, Consolas, -apple-system, BlinkMacSystemFont, 'segoe ui',
|
||||
Roboto, Oxygen, Ubuntu, Cantarell, 'open sans', 'helvetica neue';
|
||||
|
||||
@media (max-width: $phone-max-width) {
|
||||
--font-theme-size: 0.95rem;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
@@ -57,6 +53,10 @@ body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
text-size-adjust: 100%;
|
||||
|
||||
@media (max-width: $phone-max-width) {
|
||||
font-size: calc(var(--font-theme-size) * 0.95);
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
@@ -94,7 +94,7 @@ img,
|
||||
figure,
|
||||
video,
|
||||
table {
|
||||
margin: 25px 0;
|
||||
margin: calc(var(--font-theme-size) * 1.5625) 0;
|
||||
}
|
||||
|
||||
a {
|
||||
@@ -110,8 +110,8 @@ button {
|
||||
text-align: center;
|
||||
background: transparent;
|
||||
color: var(--color-theme-accent);
|
||||
padding: 5px 18px;
|
||||
border: 4px solid var(--color-theme-accent);
|
||||
padding: calc(var(--font-theme-size) * 0.315) calc(var(--font-theme-size) * 1.125);
|
||||
border: calc(var(--font-theme-size) * 0.25) solid var(--color-theme-accent);
|
||||
border-radius: var(--radius-theme-default);
|
||||
transition: background 0.15s linear;
|
||||
appearance: none;
|
||||
@@ -131,9 +131,9 @@ a:focus-visible {
|
||||
|
||||
fieldset {
|
||||
display: inline-block;
|
||||
border: 2px solid var(--color-theme-foreground);
|
||||
border-radius: calc(var(--radius-theme-default) * 1.6);
|
||||
padding: 10px;
|
||||
border: calc(var(--font-theme-size) * 0.125) solid var(--color-theme-foreground);
|
||||
border-radius: var(--radius-theme-default);
|
||||
padding: calc(var(--font-theme-size) * 0.625);
|
||||
}
|
||||
|
||||
fieldset *:first-child {
|
||||
@@ -162,9 +162,9 @@ textarea,
|
||||
select {
|
||||
background: transparent;
|
||||
color: var(--color-theme-foreground);
|
||||
border: 1px solid var(--color-theme-foreground);
|
||||
border: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-foreground);
|
||||
border-radius: var(--radius-theme-default);
|
||||
padding: 10px;
|
||||
padding: calc(var(--font-theme-size) * 0.625);
|
||||
font: inherit;
|
||||
appearance: none;
|
||||
}
|
||||
@@ -180,8 +180,8 @@ textarea:active,
|
||||
select:focus-visible,
|
||||
select:active {
|
||||
border-color: var(--color-theme-accent);
|
||||
outline: 1px solid var(--color-theme-accent);
|
||||
outline-offset: 2px;
|
||||
outline: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-accent);
|
||||
outline-offset: calc(var(--font-theme-size) * 0.125);
|
||||
}
|
||||
|
||||
input:active,
|
||||
@@ -197,10 +197,10 @@ select {
|
||||
var(--color-theme-foreground) 50%
|
||||
),
|
||||
linear-gradient(135deg, var(--color-theme-foreground) 50%, transparent 50%);
|
||||
background-position: calc(100% - 20px), calc(100% - 1em);
|
||||
background-size: 5px 5px, 5px 5px;
|
||||
background-position: calc(100% - 1.25em), calc(100% - 1em);
|
||||
background-size: calc(var(--font-theme-size) * 0.3125) calc(var(--font-theme-size) * 0.3125), calc(var(--font-theme-size) * 0.3125) calc(var(--font-theme-size) * 0.3125);
|
||||
background-repeat: no-repeat;
|
||||
padding-right: 40px;
|
||||
padding-right: calc(var(--font-theme-size) * 2.5);
|
||||
}
|
||||
|
||||
select option {
|
||||
@@ -209,8 +209,7 @@ select option {
|
||||
|
||||
input[type="checkbox"] {
|
||||
vertical-align: middle;
|
||||
padding: 10px;
|
||||
box-shadow: inset 0 0 0 3px var(--color-theme-background);
|
||||
padding: calc(var(--font-theme-size) * 0.625);
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked {
|
||||
@@ -220,9 +219,9 @@ input[type="checkbox"]:checked {
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
border: 4px solid var(--color-theme-accent);
|
||||
border: calc(var(--font-theme-size) * 0.25) solid var(--color-theme-accent);
|
||||
border-radius: var(--radius-theme-default);
|
||||
padding: 4px;
|
||||
padding: calc(var(--font-theme-size) * 0.25);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -267,8 +266,8 @@ figure figcaption {
|
||||
text-align: center;
|
||||
font-size: var(--font-theme-size);
|
||||
font-weight: normal;
|
||||
margin-top: -8px;
|
||||
padding: 0 8px;
|
||||
margin-top: calc(var(--font-theme-size) * -0.5);
|
||||
padding: 0 calc(var(--font-theme-size) * 0.5);
|
||||
border-radius: 0 0 var(--radius-theme-default) var(--radius-theme-default);
|
||||
}
|
||||
|
||||
@@ -303,18 +302,18 @@ kbd {
|
||||
font-family: inherit !important;
|
||||
font-feature-settings: normal;
|
||||
background: color-mix(in srgb, var(--color-theme-foreground) 5%, transparent);
|
||||
border: 1px solid var(--code-border);
|
||||
padding: 1px 6px;
|
||||
margin: 0 2px;
|
||||
border: calc(var(--font-theme-size) * 0.0625) solid var(--code-border);
|
||||
padding: calc(var(--font-theme-size) * 0.0625) calc(var(--font-theme-size) * 0.375);
|
||||
margin: 0 calc(var(--font-theme-size) * 0.125);
|
||||
font-size: calc(var(--font-theme-size) * 0.95);
|
||||
}
|
||||
|
||||
kbd {
|
||||
border-top: 1px solid color-mix(in srgb, var(--color-theme-accent) 25%, transparent);
|
||||
border-left: 1px solid var(--color-theme-accent);
|
||||
border-right: 1px solid var(--color-theme-accent);
|
||||
border-bottom: 4px solid var(--color-theme-accent);
|
||||
border-radius: 4px;
|
||||
border-top: calc(var(--font-theme-size) * 0.0625) solid color-mix(in srgb, var(--color-theme-accent) 25%, transparent);
|
||||
border-left: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-accent);
|
||||
border-right: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-accent);
|
||||
border-bottom: calc(var(--font-theme-size) * 0.25) solid var(--color-theme-accent);
|
||||
border-radius: calc(var(--font-theme-size) * 0.25);
|
||||
}
|
||||
|
||||
code code {
|
||||
@@ -328,11 +327,11 @@ pre {
|
||||
tab-size: 4;
|
||||
background: color-mix(in srgb, var(--color-theme-foreground) 5%, transparent) !important;
|
||||
color: var(--color-theme-foreground);
|
||||
padding: 10px 10px;
|
||||
padding: calc(var(--font-theme-size) * 0.625) calc(var(--font-theme-size) * 0.625);
|
||||
font-size: calc(var(--font-theme-size) * 0.95) !important;
|
||||
overflow: auto;
|
||||
border-radius: var(--radius-theme-default);
|
||||
border: 1px solid color-mix(in srgb, var(--color-theme-foreground) 10%, transparent);
|
||||
border: calc(var(--font-theme-size) * 0.0625) solid color-mix(in srgb, var(--color-theme-foreground) 10%, transparent);
|
||||
|
||||
@media (max-width: $phone-max-width) {
|
||||
white-space: pre-wrap;
|
||||
@@ -359,11 +358,11 @@ abbr {
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
bottom: calc(var(--font-theme-size) * -0.25);
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.25em;
|
||||
top: calc(var(--font-theme-size) * -0.25);
|
||||
}
|
||||
|
||||
mark {
|
||||
@@ -373,11 +372,11 @@ mark {
|
||||
|
||||
blockquote {
|
||||
position: relative;
|
||||
border-top: 1px solid var(--color-theme-foreground);
|
||||
border-bottom: 1px solid var(--color-theme-foreground);
|
||||
border-left: .4rem solid var(--color-theme-foreground);
|
||||
margin: 10px 0 10px 0;
|
||||
padding: 20px;
|
||||
border-top: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-foreground);
|
||||
border-bottom: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-foreground);
|
||||
border-left: calc(var(--font-theme-size) * 0.4) solid var(--color-theme-foreground);
|
||||
margin: calc(var(--font-theme-size) * 0.625) 0 calc(var(--font-theme-size) * 0.625) 0;
|
||||
padding: calc(var(--font-theme-size) * 1.25);
|
||||
}
|
||||
|
||||
blockquote p:first-child {
|
||||
@@ -396,8 +395,8 @@ table {
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 2px solid var(--color-theme-foreground);
|
||||
padding: 10px;
|
||||
border: calc(var(--font-theme-size) * 0.125) solid var(--color-theme-foreground);
|
||||
padding: calc(var(--font-theme-size) * 0.625);
|
||||
}
|
||||
|
||||
th {
|
||||
@@ -405,14 +404,14 @@ th {
|
||||
color: var(--color-theme-foreground);
|
||||
text-align: left;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
letter-spacing: calc(var(--font-theme-size) * 0.04);
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
border: none;
|
||||
background: var(--color-theme-accent);
|
||||
height: 2px;
|
||||
height: calc(var(--font-theme-size) * 0.125);
|
||||
}
|
||||
|
||||
/* One Heading Size */
|
||||
@@ -422,9 +421,9 @@ hr {
|
||||
.headings--one-size h4,
|
||||
.headings--one-size h5,
|
||||
.headings--one-size h6 {
|
||||
font-size: 1.4rem;
|
||||
font-size: calc(var(--font-theme-size) * 1.4);
|
||||
line-height: 1.3;
|
||||
margin: 20px 0;
|
||||
margin: calc(var(--font-theme-size) * 1.25) 0;
|
||||
}
|
||||
|
||||
.headings--one-size ~ h1:first-child,
|
||||
@@ -433,7 +432,7 @@ hr {
|
||||
.headings--one-size ~ h4:first-child,
|
||||
.headings--one-size ~ h5:first-child,
|
||||
.headings--one-size ~ h6:first-child {
|
||||
margin-top: 20px;
|
||||
margin-top: calc(var(--font-theme-size) * 1.25);
|
||||
}
|
||||
|
||||
blockquote.twitter-tweet {
|
||||
@@ -441,8 +440,8 @@ blockquote.twitter-tweet {
|
||||
background: var(--color-theme-background);
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
border: 1px solid var(--color-theme-accent);
|
||||
padding-top: 60px;
|
||||
border: calc(var(--font-theme-size) * 0.0625) solid var(--color-theme-accent);
|
||||
padding-top: calc(var(--font-theme-size) * 3.75);
|
||||
}
|
||||
|
||||
blockquote.twitter-tweet a {
|
||||
@@ -453,39 +452,65 @@ blockquote.twitter-tweet a {
|
||||
blockquote.twitter-tweet::before {
|
||||
content: "> From X:";
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
top: calc(var(--font-theme-size) * 1.25);
|
||||
left: calc(var(--font-theme-size) * 1.25);
|
||||
color: var(--color-theme-accent);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.container {
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40px;
|
||||
max-width: 864px;
|
||||
min-height: 80vh;
|
||||
border-right: 1px solid color-mix(in srgb, var(--color-theme-accent) 10%, transparent);
|
||||
|
||||
@media (max-width: $phone-max-width) {
|
||||
padding: 20px;
|
||||
}
|
||||
min-height: 100vh
|
||||
}
|
||||
|
||||
.container.full, .container.center {
|
||||
border: none;
|
||||
.main-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.layout-wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar-left,
|
||||
.sidebar-right {
|
||||
width: 20%;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--font-theme-size) * 1.25);
|
||||
}
|
||||
|
||||
.center.container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: calc(var(--font-theme-size) * 2.5);
|
||||
width: 60%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.container.full {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.sidebar-left,
|
||||
.sidebar-right {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.center.container {
|
||||
padding: calc(var(--font-theme-size) * 1.25);
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -514,13 +539,13 @@ blockquote.twitter-tweet::before {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
width: calc(var(--font-theme-size) * 3.75);
|
||||
height: calc(var(--font-theme-size) * 3.75);
|
||||
}
|
||||
|
||||
iframe[src*="youtube.com"] {
|
||||
border: 8px solid var(--color-theme-accent) !important;
|
||||
padding: 8px !important;
|
||||
border: calc(var(--font-theme-size) * 0.5) solid var(--color-theme-accent) !important;
|
||||
padding: calc(var(--font-theme-size) * 0.5) !important;
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
||||
Reference in New Issue
Block a user