@import "@fontsource-variable/inter"; @import "@fontsource-variable/jetbrains-mono"; @import "tailwindcss"; @import "./showcase/kit.css"; /* The Open Graph picture's source is drawn on its own, with its own styles, so none of its words become utilities here. */ @source not "../og.html"; @custom-variant hover (&:hover); @custom-variant stacked (@media (width <= 960px)); @custom-variant compact (@media (width <= 520px)); @custom-variant diagram-medium (@container diagram (width <= 720px)); @custom-variant diagram-narrow (@container diagram (width <= 560px)); @theme { --color-*: initial; --color-background: oklch(100% 0 0); --color-foreground: oklch(21% 0.006 285.885); --color-muted: oklch(96.7% 0.001 286.375); --color-muted-foreground: oklch(44.2% 0.017 285.786); --color-subtle-foreground: oklch(70.5% 0.015 286.067); --color-prose-foreground: oklch(37% 0.013 285.805); --color-card: oklch(98.5% 0 0); --color-border: oklch(92% 0.004 286.32); --color-border-strong: oklch(87.1% 0.006 286.286); --color-ring: color-mix(in oklab, var(--color-foreground) 14%, transparent); --color-wash: color-mix(in oklab, var(--color-foreground) 7%, transparent); --color-accent: oklch(55% 0.2 270); --color-accent-foreground: oklch(100% 0 0); --color-accent-text: oklch(55% 0.2 270); --color-white: oklch(100% 0 0); --color-positive: oklch(50% 0.14 150); --color-negative: oklch(53% 0.2 27); --color-marker: oklch(60% 0.23 27); --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif; --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, monospace; --default-font-feature-settings: "cv11", "ss01"; --default-mono-font-feature-settings: "cv11", "ss01"; --text-*: initial; --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem; --text-lg: 1.125rem; --text-control: 14px; --text-control--line-height: 1.4; --text-code: 12.5px; --text-code--line-height: 1.7; --spacing: 4px; --radius-*: initial; --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --breakpoint-*: initial; --breakpoint-rail: 1200px; --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1); --default-transition-timing-function: ease; /* Lucide icons, as masks for the icons that CSS draws. The rest come from the lucide package, in components/Icon.ts. */ --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); --icon-reset: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E"); --icon-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z'/%3E%3C/svg%3E"); --icon-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3C/svg%3E"); } @property --column { syntax: ""; inherits: true; initial-value: 0px; } @layer components { /* Off screen until the keyboard reaches it. */ .skip-link { @apply absolute top-2 left-2 z-20 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background; transform: translateY(-200%); &:focus { transform: none; } } .article-masthead { @apply mx-auto mb-9 flex max-w-(--column) items-center justify-between gap-4; } .article-brand { @apply inline-flex items-center; } .article-links { @apply flex items-center gap-5 text-xs text-muted-foreground; a:hover { color: var(--color-foreground); } } .article-header { --header-grid: calc(var(--column) / 6); @apply relative isolate -mx-[clamp(20px,5vw,48px)] border-y border-border px-[clamp(20px,5vw,48px)] py-9 rail:mx-auto rail:max-w-(--wide) rail:px-0; background-image: linear-gradient(to right, var(--color-border) 1px, transparent 1px); background-size: var(--header-grid) 100%; background-position: center; /* A fade over the lines at the top and the bottom. */ &::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to bottom, var(--color-background), transparent 50%, var(--color-background)); } /* The pulse of the grid on effect.website. When the page loads, a ring grows from the middle of the header, and the lines inside it are brighter. It is under the fade and the text. */ &::after { --ring-start: max(0px, var(--header-bloom) - 150px); --ring-end: calc(var(--header-bloom) + 60px); --ring-line: color-mix(in oklab, var(--color-foreground) 35%, transparent); --ring-fill: color-mix(in oklab, var(--color-foreground) 3%, transparent); content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background-image: linear-gradient(to right, var(--ring-line) 1px, transparent 1px), linear-gradient(var(--ring-fill), var(--ring-fill)); background-size: var(--header-grid) 100%, 100% 100%; background-position: center; mask-image: radial-gradient( circle farthest-corner at center, transparent var(--ring-start), #000 calc(var(--ring-start) * 0.3 + var(--ring-end) * 0.7), transparent var(--ring-end) ); } @media (prefers-reduced-motion: no-preference) { &::after { animation: header-bloom 3s linear both; } } > * { position: relative; } .article-eyebrow { @apply mb-5; } } .article-eyebrow { @apply font-mono text-[10px] font-medium tracking-[0.1em] text-muted-foreground; } .code-window { @apply bg-card; box-shadow: 0 2px 3px -2px var(--color-ring); } .counter { @apply inline-flex flex-wrap items-center gap-2; } .counter-label { @apply font-medium; } .counter-value { @apply min-w-[3ch] text-center font-mono text-lg font-semibold tabular-nums; } /* Page's own button has no class. :where keeps this selector as weak as .counter-button, so the colored buttons' hover still wins. */ .counter-button, :where(.counter-page) > button { @apply inline-flex min-w-9 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-border-strong bg-background px-3 py-1.5 text-control font-medium; transition: border-color 150ms, background-color 150ms, opacity 150ms; &:hover { @apply border-foreground bg-muted; } &:disabled, &[aria-disabled="true"] { @apply cursor-not-allowed border-border-strong bg-background opacity-50; } } .counter-reset, .counter-start, .counter-stop { &::before { content: ""; @apply size-3.5 flex-none bg-current; mask: var(--counter-icon) center / contain no-repeat; } } .counter-add, .counter-start, .counter-stop { &:hover { opacity: 0.85; } } .counter-reset { --counter-icon: var(--icon-reset); } .counter-add { @apply border-foreground bg-foreground text-background tabular-nums; &:hover { @apply border-foreground bg-foreground; } } .counter-start { --counter-icon: var(--icon-play); @apply border-positive bg-positive text-white; &:hover { @apply border-positive bg-positive; } } .counter-stop { --counter-icon: var(--icon-stop); @apply border-negative bg-negative text-white; &:hover { @apply border-negative bg-negative; } } /* In a row, so hiding the Counter doesn't change the height. */ .counter-page { @apply flex flex-wrap items-center gap-x-5 gap-y-3; } @media (width <= 520px) { .article-masthead { @apply mb-6; } .article-header { @apply py-7; } .article-links { @apply gap-3; } } } @layer base { :root { color-scheme: light dark; } @media (prefers-color-scheme: dark) { :root { --color-background: oklch(14.1% 0.005 285.823); --color-foreground: oklch(98.5% 0 0); --color-muted: oklch(21% 0.006 285.885); --color-muted-foreground: oklch(70.5% 0.015 286.067); --color-subtle-foreground: oklch(55.2% 0.016 285.938); --color-prose-foreground: oklch(87.1% 0.006 286.286); /* Between the page and muted, as in the light theme, so a muted strip on a card shows. */ --color-card: oklch(17.5% 0.005 285.85); --color-border: oklch(27.4% 0.006 286.033); --color-border-strong: oklch(37% 0.013 285.805); --color-ring: color-mix(in oklab, var(--color-foreground) 22%, transparent); --color-wash: color-mix(in oklab, var(--color-foreground) 9%, transparent); --color-accent-text: oklch(74% 0.14 270); } } ::selection { background: color-mix(in oklab, var(--color-accent) 28%, transparent); } html { background: var(--color-background); color: var(--color-foreground); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; } /* Everything that can be pressed or dragged shows a pointer. */ a[href], button:not(:disabled, [aria-disabled="true"]), [role="button"]:not([aria-disabled="true"]), select:not(:disabled), summary, label[for] { cursor: pointer; } :focus-visible { outline: 2px solid var(--color-foreground); outline-offset: 2px; } } /* Diagram motion: a packet travels its path once and fades out, and a link draws itself as the packet goes. With reduced motion the packet stays hidden and the link is drawn at once. */ @layer components { /* Where a dot is once it has travelled, and where it is drawn when motion is reduced. */ .diagram-packet { offset-rotate: 0deg; offset-distance: 100%; } @media (prefers-reduced-motion: no-preference) { .diagram-packet { animation: diagram-travel var(--diagram-travel, 850ms) ease-in-out both; } .diagram-draw { stroke-dasharray: 1; animation: diagram-draw var(--diagram-travel, 850ms) ease-in-out both; } } } @keyframes diagram-travel { from { offset-distance: 0%; } } @keyframes diagram-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } } /* The bars of the performance chart grow from the left as the chart scrolls up from the bottom of the window, each starting a little after the one above it. The last is full when the chart is a little below the middle of the window. The scroll position drives them, so they are drawn in full wherever a browser can't do that. */ @supports (animation-timeline: view()) { @media (prefers-reduced-motion: no-preference) { .chart-bars { view-timeline: --chart-bars block; } .chart-bar { animation: chart-bar-grow linear both; animation-timeline: --chart-bars; animation-range: cover calc(var(--bar, 0) * 2.5%) cover calc(27% + var(--bar, 0) * 2.5%); } .chart-bars > :nth-child(2) { --bar: 1; } .chart-bars > :nth-child(3) { --bar: 2; } .chart-bars > :nth-child(4) { --bar: 3; } .chart-bars > :nth-child(5) { --bar: 4; } .chart-bars > :nth-child(6) { --bar: 5; } } } /* The arrow to the DevTools button, in red marker on the page, under its content. Its tail is at a place on the page, beside the first lines of its part of the article. Its tip is 10px above the button, which is fixed to the corner of the window, so the arrow stretches as the page scrolls. Once the DevTools heading nears the top of the window, the tip releases and the arrow scrolls away with the page. It needs the margin beside the text, and a browser that can tie an animation to the scroll position. */ .launcher-pointer { display: none; } @supports (animation-timeline: view()) { @media (width >= 960px) { /* From where the tail is on the page to a window's height below it, which is long enough to follow the tail until its part of the article has left the window. */ .launcher-tail { --pointer-width: clamp(60px, (100vw - 1280px) * 0.5 + 90px, 240px); --pointer-stroke: clamp(5px, var(--pointer-width) * 0.035, 8px); @apply pointer-events-none absolute h-screen w-0; view-timeline: --launcher-tail block; animation: launcher-pointer-tail linear both; animation-timeline: --launcher-tail; } /* A box from the tail to the tip. Its right edge is over the middle of the button, which is 87px by 34px and 12px from the corner. Each element here has one animation, because the build gives a list of them a duration of 0s, which a scroll position can't drive. */ .launcher-pointer { @apply fixed -z-1 block w-(--pointer-width) text-marker; top: var(--launcher-tail-top); right: 55.5px; bottom: 56px; animation: launcher-pointer-tip linear both; animation-timeline: --launcher-tail; /* Stays anchored at 56px until the tail reaches 72px from the top (the DevTools heading at ~20px), then rises 1:1 with the scroll across the remaining 100vh - 44px until the tip clears the top. */ animation-range: entry calc(100% - 72px) exit calc(100% - 116px); } /* It shows once the tail is well above the tip. */ .launcher-pointer-ink { @apply absolute inset-0; animation: launcher-pointer-in linear both; animation-timeline: --launcher-tail; animation-range: 150px 240px; } .launcher-pointer svg { @apply absolute overflow-visible; stroke-width: var(--pointer-stroke); } .launcher-pointer path { vector-effect: non-scaling-stroke; } .launcher-pointer-line { @apply inset-0 size-full; } /* Its point is at the tip. */ .launcher-pointer-head { --head: clamp(26px, var(--pointer-width) * 0.2, 44px); right: calc(var(--head) / -2); bottom: 0; width: var(--head); height: calc(var(--head) * 15 / 26); } } } /* How far the tail is from the top of the window. Registered, so it can be animated. */ @property --launcher-tail-top { syntax: ""; inherits: true; initial-value: 100%; } /* The tail's element is a window tall, so over its time in the window its top goes from the bottom edge to a window's height above the top one. The line starts 28px below that, level with the middle of the first lines. */ @keyframes launcher-pointer-tail { from { --launcher-tail-top: calc(100% + 28px); } to { --launcher-tail-top: calc(28px - 100%); } } /* Once the DevTools heading nears the top of the window, the tip releases and moves upward 1:1 with the scroll until past the top. */ @keyframes launcher-pointer-tip { from { bottom: 56px; } to { bottom: calc(100% + 12px); } } @keyframes launcher-pointer-in { from { opacity: 0; } to { opacity: 1; } } @keyframes chart-bar-grow { from { clip-path: inset(0 100% 0 0 round 3px); } to { clip-path: inset(0 0 0 0 round 3px); } } /* The ring's radius, as a share of the way from the middle of the header to its corners. Registered, so it can be animated. */ @property --header-bloom { syntax: ""; inherits: false; initial-value: 0px; } /* As on effect.website: the ring passes the corners 150px behind it after 2.3 seconds, keeps growing, and fades over the last 0.6. */ @keyframes header-bloom { from { --header-bloom: 0px; opacity: 1; } 80% { opacity: 1; } to { --header-bloom: calc(130.43% + 195.65px); opacity: 0; } }