main.learn { --top-offset: 6rem; --content-width: 52rem; display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 4rem; padding: 0 var(--page-x); article { counter-reset: theme; padding-top: var(--top-offset); padding-bottom: calc(var(--top-offset) / 2); &::before { content: ""; position: sticky; top: 0; z-index: 2; display: block; height: var(--top-offset); margin-top: calc(-1 * var(--top-offset)); margin-inline: auto; margin-bottom: calc(-1 * var(--top-offset)); background: var(--black); pointer-events: none; } > section { counter-increment: theme; counter-reset: topic; width: min(100%, var(--content-width)); margin-inline: auto; scroll-margin-top: var(--top-offset); } > section:first-of-type { margin-top: calc(-1 * var(--top-offset)); padding-top: var(--top-offset); } > section + section { margin-top: 8rem; } section section { counter-increment: topic; scroll-margin-top: var(--top-offset); } } h1, h2 { position: sticky; top: var(--top-offset); padding-bottom: 0.5rem; background: var(--black); line-height: 1; a { position: relative; display: inline-block; color: var(--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; border-bottom: 1px solid var(--dark-gray); font-size: 2.75rem; a::before { content: counter(theme, upper-roman) ". "; } } h2 { z-index: 1; padding-top: 4.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; } } }