Files
2026-06-04 18:35:48 +02:00

202 lines
3.6 KiB
CSS

main.learn {
--sticky-h: 5rem;
--sidebar-top: 6rem;
--sidebar-bottom: 1rem;
display: flex;
overflow: hidden;
article {
position: relative;
counter-reset: theme;
min-width: 0;
min-height: 0;
overflow: auto;
scroll-behavior: smooth;
scrollbar-gutter: stable;
&::before {
content: "";
position: sticky;
top: 0;
z-index: 2;
display: block;
width: min(100%, 52rem);
height: var(--sticky-h);
margin-inline: auto;
margin-bottom: calc(-1 * var(--sticky-h));
background: var(--black);
pointer-events: none;
}
> section {
counter-increment: theme;
counter-reset: topic;
width: min(100%, 52rem);
margin-inline: auto;
}
> section + section {
margin-top: 8rem;
}
section section {
counter-increment: topic;
margin-top: 4rem;
}
}
h1,
h2 {
position: sticky;
background: var(--black);
line-height: 1;
a {
position: relative;
display: inline-block;
color: white;
text-decoration: none;
&::before {
position: absolute;
top: 50%;
right: 100%;
translate: 0 -50%;
opacity: 0;
user-select: none;
text-decoration: none;
}
&:hover::before {
opacity: 0.5;
}
&:hover {
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 0.125em;
}
&:active {
color: var(--orange);
}
}
}
h1 {
z-index: 3;
top: var(--sticky-h);
scroll-margin-top: var(--sticky-h);
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--dark-gray);
font-size: 2.75rem;
a::before {
content: counter(theme, upper-roman) ". ";
}
}
h2 {
z-index: 1;
top: var(--sticky-h);
scroll-margin-top: var(--sticky-h);
padding-top: 3.5rem;
padding-bottom: 0.5rem;
border-bottom: 1px dashed var(--dark-gray);
font-size: 1.5rem;
a::before {
content: counter(topic) ". ";
}
}
p {
margin-top: 1rem;
color: var(--dark-white);
}
figure {
margin-top: 2rem;
color: var(--gray);
font-size: var(--font-size-xs);
text-transform: uppercase;
> div {
height: 18rem;
display: grid;
place-items: center;
border: 1px solid var(--dark-gray);
font-size: var(--font-size-sm);
}
figcaption {
margin-top: 0.75rem;
}
}
> nav {
counter-reset: content-theme;
min-height: 0;
overflow: auto;
scrollbar-gutter: stable;
padding-top: var(--sidebar-top);
padding-bottom: var(--sidebar-bottom);
font-size: var(--font-size-xs);
line-height: var(--line-height-sm);
text-transform: uppercase;
ol {
list-style: none;
margin: 0;
padding: 0;
}
> ol > li {
counter-increment: content-theme;
counter-reset: content-topic;
}
ol ol {
margin-top: 0.5rem;
margin-left: 1rem;
color: var(--gray);
}
ol ol > li {
counter-increment: content-topic;
}
li + li {
margin-top: 0.5rem;
}
a {
color: inherit;
text-decoration: none;
&::before {
opacity: 0.5;
}
&:hover {
color: var(--orange);
}
}
> ol > li > a::before {
content: counter(content-theme, upper-roman) ". ";
}
ol ol > li > a::before {
content: counter(content-topic) ". ";
}
}
}
@media (prefers-reduced-motion: reduce) {
main.learn article {
scroll-behavior: auto;
}
}