Files
commonflow.org/src/styles/global.css
Jim Myhrberg e5d2604edc feat: migrate to Astro's experimental font API
Replace @fontsource-variable NPM packages with Astro's built-in
experimental font API using the Fontsource provider. Fonts are now
fetched at build time, cached locally, and served with the site.

This provides automatic @font-face generation, preload link injection,
and metric-adjusted fallback fonts (size-adjust, ascent-override, etc.)
to reduce CLS during font loading.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:43:48 +00:00

558 lines
10 KiB
CSS

@import "tailwindcss";
@plugin "@tailwindcss/typography";
@custom-variant dark (&:where(.dark, .dark *));
@theme {
/* Accent colors - using Tailwind sky palette */
--color-accent: theme(colors.sky.500);
--color-accent-light: theme(colors.sky.400);
/* Fonts - via Astro experimental font API (fontsource provider) */
--font-display: var(--font-bricolage);
--font-sans: var(--font-dm-sans);
--font-mono: var(--font-jetbrains);
/* Sizing */
--header-height: 4rem;
--sidebar-width: 260px;
--content-max-width: 800px;
--section-padding-y: 6rem;
--section-padding-x: 2rem;
/* Transitions */
--transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
--transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
--transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
--transition-smooth: 600ms cubic-bezier(0.16, 1, 0.3, 1);
/* Shadows */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
--shadow-glow: 0 0 40px theme(colors.sky.500 / 15%);
}
/* Smooth scroll */
html {
scroll-behavior: smooth;
}
/* Scroll margin for anchor links */
[id] {
scroll-margin-top: calc(var(--header-height) + 2rem);
}
/* Base styles */
@layer base {
html {
height: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: var(--font-sans);
font-size: 16px;
font-weight: 400;
line-height: 1.7;
overflow-x: hidden;
background-color: theme(colors.slate.50);
color: theme(colors.slate.950);
}
.dark body {
background-color: theme(colors.neutral.950);
color: theme(colors.neutral.50);
}
/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: var(--font-display);
font-weight: 700;
line-height: 1.2;
letter-spacing: -0.02em;
color: theme(colors.slate.950);
}
.dark h1,
.dark h2,
.dark h3,
.dark h4,
.dark h5,
.dark h6 {
color: theme(colors.neutral.50);
}
h1 {
font-size: clamp(2.5rem, 6vw, 4.5rem);
font-weight: 800;
letter-spacing: -0.03em;
}
h2 {
font-size: clamp(1.75rem, 4vw, 2.5rem);
margin-top: 3rem;
margin-bottom: 1.5rem;
}
h3 {
font-size: clamp(1.25rem, 2vw, 1.5rem);
margin-top: 2rem;
margin-bottom: 1rem;
}
p {
margin-bottom: 1.25rem;
}
/* Links */
a {
color: var(--color-accent);
text-decoration: none;
transition: color var(--transition-fast);
word-break: break-word;
}
a:hover {
color: var(--color-accent-light);
}
/* Code */
code {
font-family: var(--font-mono);
font-size: 0.875em;
border-radius: 4px;
padding: 0.2em 0.4em;
background-color: theme(colors.slate.950 / 5%);
}
.dark code {
background-color: theme(colors.neutral.400 / 15%);
}
pre {
font-family: var(--font-mono);
border-radius: 8px;
padding: 1.25rem;
overflow-x: auto;
line-height: 1.6;
background-color: theme(colors.slate.200);
}
.dark pre {
background-color: theme(colors.neutral.900);
}
pre>code {
background-color: transparent !important;
padding: 0;
font-size: 0.875rem;
}
/* Lists */
ul,
ol {
margin-bottom: 1.25rem;
padding-left: 1.5rem;
}
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}
li {
margin-bottom: 0.5rem;
}
ol ol,
ul ol {
list-style-type: decimal;
}
ul ul ol,
ul ol ol,
ol ul ol,
ol ol ol {
list-style-type: decimal;
}
/* Blockquotes */
blockquote {
border-left: 3px solid var(--color-accent);
padding-left: 1.5rem;
margin: 1.5rem 0;
font-style: italic;
color: theme(colors.slate.600);
}
.dark blockquote {
color: theme(colors.neutral.400);
}
/* Strong text */
strong {
font-weight: 600;
}
/* Focus styles */
:focus-visible {
outline: 2px solid var(--color-accent);
outline-offset: 2px;
}
}
/* Keyframe animations - defined outside layers for proper cascade */
@keyframes clause-highlight-pulse {
0% {
background-color: theme(colors.sky.500 / 15%);
}
100% {
background-color: transparent;
}
}
@keyframes clause-highlight-pulse-dark {
0% {
background-color: theme(colors.sky.700 / 20%);
}
100% {
background-color: transparent;
}
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fade-in-up {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fade-in-down {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slide-in-left {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes bounce-subtle {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-8px);
}
}
/* Animation utility classes */
.animate-fade-in {
opacity: 0;
animation: fade-in 400ms ease-out forwards;
}
.animate-fade-in-up {
opacity: 0;
animation: fade-in-up 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-fade-in-down {
opacity: 0;
animation: fade-in-down 250ms ease-out forwards;
}
.animate-slide-in-left {
opacity: 0;
animation: slide-in-left 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-bounce-subtle {
animation: bounce-subtle 2s ease-in-out infinite;
}
/* Animation delays */
.delay-100 {
animation-delay: 100ms;
}
.delay-200 {
animation-delay: 200ms;
}
.delay-300 {
animation-delay: 300ms;
}
.delay-400 {
animation-delay: 400ms;
}
.delay-500 {
animation-delay: 500ms;
}
.delay-600 {
animation-delay: 600ms;
}
.delay-700 {
animation-delay: 700ms;
}
.delay-800 {
animation-delay: 800ms;
}
/* Component styles */
@layer components {
/* Section container - uses CSS vars, keep here */
.section-container {
max-width: calc(var(--content-max-width) + var(--sidebar-width) + 4rem);
margin: 0 auto;
padding: 0 var(--section-padding-x);
}
/* Prose styling for markdown content - can't add classes to rendered HTML */
.prose-spec {
max-width: var(--content-max-width);
}
.prose-spec h2 {
font-size: 1.75rem;
margin-top: 3rem;
margin-bottom: 1.5rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid theme(colors.slate.200);
}
.dark .prose-spec h2 {
border-bottom-color: theme(colors.neutral.800);
}
.prose-spec h2:first-child {
margin-top: 0;
}
.prose-spec h3 {
font-size: 1.25rem;
font-weight: 600;
margin-top: 2rem;
margin-bottom: 1rem;
color: theme(colors.slate.600);
}
.dark .prose-spec h3 {
color: theme(colors.neutral.400);
}
.prose-spec p {
color: theme(colors.slate.600);
}
.dark .prose-spec p {
color: theme(colors.neutral.400);
}
.prose-spec strong {
color: theme(colors.neutral.700);
}
.dark .prose-spec strong {
color: theme(colors.neutral.300);
}
.prose-spec li {
color: theme(colors.slate.600);
}
.dark .prose-spec li {
color: theme(colors.neutral.400);
}
/* Spec clauses - ordered list with CSS counters and hover anchor links */
.prose-spec ol {
padding-left: 2.25rem;
counter-reset: item;
list-style: none;
}
.prose-spec ol>li {
counter-increment: item;
position: relative;
margin-bottom: 0.5rem;
}
.prose-spec ol>li::before {
content: counters(item, ".") ".";
position: absolute;
left: -2.5rem;
width: 2rem;
text-align: right;
font-weight: 500;
color: theme(colors.slate.400);
}
.dark .prose-spec ol>li::before {
color: theme(colors.neutral.500);
}
/* Clause highlight effect using ::after pseudo-element */
.prose-spec ol>li::after {
content: "";
position: absolute;
inset: -0.25rem -0.5rem;
left: -2.75rem;
background-color: transparent;
border-radius: 4px;
pointer-events: none;
z-index: -1;
}
.prose-spec ol>li.clause-highlight::after {
animation: clause-highlight-pulse 2s ease-out forwards;
}
.dark .prose-spec ol>li.clause-highlight::after {
animation: clause-highlight-pulse-dark 2s ease-out forwards;
}
/* Anchor link with clause number - hidden by default, shown on hover */
.prose-spec .clause-link {
position: absolute;
right: 100%;
padding-right: 0.5rem;
font-weight: 500;
color: theme(colors.slate.400);
text-decoration: none;
opacity: 0;
display: flex;
align-items: center;
gap: 0.25rem;
white-space: nowrap;
}
.dark .prose-spec .clause-link {
color: theme(colors.neutral.500);
}
/* Link icon in the anchor link */
.prose-spec .clause-link-icon {
flex-shrink: 0;
width: 0.875rem;
height: 0.875rem;
}
/* On hover: show anchor link, hide CSS counter */
.prose-spec ol>li:hover:not(:has(ol:hover))>.clause-link,
.prose-spec ol>li:hover:not(:has(ol:hover))>p>.clause-link,
.prose-spec .clause-link:hover {
opacity: 1;
}
.prose-spec ol>li:hover:not(:has(ol:hover))::before {
opacity: 0;
}
/* Hover color for clause anchor link */
.prose-spec .clause-link:hover {
color: theme(colors.sky.500);
}
.prose-spec img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin: 2rem 0;
}
.prose-spec p:last-child {
margin-bottom: 0;
}
/* Nav link active state (toggled by JavaScript) */
.nav-link.active {
color: theme(colors.sky.700) !important;
background-color: theme(colors.sky.600 / 15%) !important;
}
.dark .nav-link.active {
color: theme(colors.sky.400) !important;
background-color: theme(colors.sky.600 / 20%) !important;
}
/* Sidebar link active state (toggled by JavaScript) */
.sidebar-link.active {
color: theme(colors.sky.700) !important;
background-color: theme(colors.sky.600 / 15%) !important;
}
.dark .sidebar-link.active {
color: theme(colors.sky.400) !important;
background-color: theme(colors.sky.600 / 20%) !important;
}
/* Sidebar scrollbar styling */
#spec-sidebar::-webkit-scrollbar {
width: 4px;
}
#spec-sidebar::-webkit-scrollbar-track {
background: transparent;
}
#spec-sidebar::-webkit-scrollbar-thumb {
background-color: theme(colors.slate.200);
border-radius: 2px;
}
.dark #spec-sidebar::-webkit-scrollbar-thumb {
background-color: theme(colors.neutral.800);
}
}