feat: restructure styles and components for improved design system

- Added typography and design system styles to globals.css.
- Removed deprecated home.css and landing.css files.
- Introduced DiscordSignInButton component for Discord authentication.
- Created Card and CardGrid components for structured content display.
- Implemented ContainerShowcase to demonstrate card usage and layout.
- Added DesignSystemTabs for navigation between design system sections.
- Established typography.css for consistent text styling across components.
- Added tests for typography styles to ensure compliance with design standards.
This commit is contained in:
syntaxbullet
2026-09-04 12:37:56 +02:00
parent 084603bb6e
commit bfa54851c2
23 changed files with 1177 additions and 2937 deletions

View File

@@ -24,8 +24,8 @@
min-height: 100vh;
color: var(--ds-ink);
background: var(--ds-paper);
font:
14px/1.5 -apple-system,
@apply type-body;
font-family: -apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
@@ -39,15 +39,11 @@
.ds-root :where(h1, h2, h3, h4, p, figure) {
margin: 0;
}
.ds-root :where(h1, h2) {
font-family: var(--ds-serif);
font-weight: 400;
line-height: 1.05;
}
.ds-root :where(h3, h4) {
font-weight: 400;
}
.ds-root a {
.ds-root :where(h1) { @apply type-display; }
.ds-root :where(h2) { @apply type-section; }
.ds-root :where(h3, h4) { @apply type-title; }
.ds-root :where(small) { @apply type-small; }
.ds-root :where(a) {
color: inherit;
text-decoration: none;
}
@@ -55,8 +51,7 @@
text-decoration: underline;
text-underline-offset: 5px;
}
.ds-root button,
.ds-root input {
.ds-root :where(button, input, select, textarea) {
font: inherit;
border-radius: 0;
}
@@ -80,16 +75,15 @@
color: var(--ds-secondary);
}
.ds-code {
font:
11px/1.6 ui-monospace,
@apply type-small;
font-family: ui-monospace,
SFMono-Regular,
Consolas,
monospace;
}
.ds-eyebrow {
font-size: 10px;
letter-spacing: 0.13em;
font-weight: 500;
@apply type-eyebrow;
color: #737373;
}
.ds-header {
max-width: 1280px;
@@ -103,18 +97,17 @@
}
.ds-wordmark {
font-family: var(--ds-serif);
font-size: 35px;
line-height: 1;
@apply type-title;
letter-spacing: -1.2px;
}
.ds-header nav {
display: flex;
gap: 30px;
font-size: 12px;
@apply type-small;
}
.ds-edition {
color: var(--ds-secondary);
font-size: 9px;
@apply type-small;
letter-spacing: 0.12em;
}
.ds-main {
@@ -122,6 +115,66 @@
padding: 0 48px;
margin: auto;
}
.ds-library-label,
.ds-library-note {
@apply type-small;
color: var(--ds-secondary);
}
.ds-library-intro {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
padding: 36px 0 28px;
}
.ds-library-intro h1 {
@apply type-section;
font-family: var(--ds-serif);
font-weight: 400;
margin: 10px 0;
}
.ds-library-intro p:not(.ds-eyebrow) { color: var(--ds-secondary); }
.ds-library-note { max-width: 180px; text-align: right; }
.ds-tab-bar {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
gap: 4px;
padding: 6px;
background: #f5f5f5;
}
.ds-tab-bar [role="tab"] {
@apply type-body;
background: transparent;
color: var(--ds-secondary);
border: 1px solid transparent;
padding: 10px 8px;
}
.ds-tab-bar [role="tab"]:hover { background: #ebebeb; color: var(--ds-ink); }
.ds-tab-bar [aria-selected="true"] {
background: var(--ds-paper);
color: var(--ds-ink);
border-color: var(--ds-rule);
}
.ds-tab-bar [role="tab"]:focus-visible { outline-offset: -3px; }
.ds-tab-panel { min-width: 0; min-height: 420px; }
.ds-tab-panel[hidden] { display: none; }
.ds-tab-panel > .ds-section { border-top: 0; }
@media (max-width: 1000px) {
.ds-tab-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
.ds-library-intro { display: block; padding: 28px 0 24px; }
.ds-library-note { display: block; max-width: none; text-align: left; margin-top: 16px; }
.ds-tab-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ds-header nav { flex-wrap: wrap; }
.ds-header nav [aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.ds-account-controls { padding: 24px 0; border-top: 1px solid var(--ds-rule); }
.ds-account-controls p { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ds-account-controls [role="alert"] { margin-top: 16px; }
.ds-type-scale { list-style: none; padding: 0; margin: 24px 0; }
.ds-type-scale li { display: grid; gap: 8px; padding: 20px 0; border-top: 1px solid var(--ds-rule); }
.ds-type-scale code { @apply type-small; color: var(--ds-secondary); overflow-wrap: anywhere; }
.ds-intro {
display: flex;
justify-content: space-between;
@@ -130,31 +183,30 @@
padding: 85px 0 72px;
}
.ds-intro h1 {
font-size: clamp(64px, 6.6vw, 90px);
letter-spacing: -2.4px;
@apply type-display;
margin: 23px 0 26px;
}
.ds-intro h1 em {
font-weight: 400;
}
.ds-intro-copy {
@apply type-body;
color: var(--ds-secondary);
line-height: 1.7;
}
.ds-intro-note {
width: 220px;
padding-bottom: 4px;
font-size: 12px;
@apply type-small;
}
.ds-tiny-cross {
display: block;
font-size: 27px;
@apply type-title;
font-weight: 200;
margin-bottom: 20px;
}
.ds-intro-note p {
color: var(--ds-secondary);
line-height: 1.8;
margin-bottom: 29px;
}
.ds-intro-note a {
@@ -166,7 +218,7 @@
}
.ds-section {
padding: 42px 0 56px;
border-top: 1px solid var(--ds-ink);
border-top: 1px solid var(--ds-rule);
}
.ds-section-top {
display: flex;
@@ -176,27 +228,25 @@
margin-bottom: 32px;
}
.ds-section-top h2 {
font-size: 42px;
@apply type-section;
margin-top: 15px;
letter-spacing: -0.7px;
}
.ds-section-top > p {
font-size: 12px;
@apply type-small;
}
.ds-demo-note {
color: var(--ds-secondary);
font-size: 11px;
white-space: nowrap;
@apply type-small;
white-space: normal;
}
.ds-demo-note > span {
font-size: 20px;
@apply type-lead;
vertical-align: -1px;
padding-right: 4px;
}
.ds-preview-toolbar {
display: flex;
justify-content: space-between;
border-bottom: 1px solid var(--ds-rule);
}
.ds-view-switch {
display: flex;
@@ -208,15 +258,12 @@
border: 0;
border-bottom: 2px solid transparent;
padding: 13px 0;
font-size: 12px;
@apply type-small;
}
.ds-view-switch button[aria-pressed="true"] {
border-bottom-color: var(--ds-ink);
color: var(--ds-ink);
}
.ds-preview-toolbar > .ds-button {
font-size: 11px;
}
.ds-preview-heading {
display: flex;
justify-content: space-between;
@@ -224,24 +271,22 @@
gap: 20px;
padding: 32px 0 22px;
}
.ds-preview-heading .ds-eyebrow {
color: var(--ds-secondary);
font-size: 9px;
}
.ds-preview-heading h3 {
font-family: var(--ds-serif);
font-size: 30px;
@apply type-title;
margin-top: 8px;
}
.ds-preview-heading > p {
color: var(--ds-secondary);
font-size: 12px;
@apply type-small;
padding-bottom: 4px;
}
.ds-habit-row {
border-top: 1px solid var(--ds-rule);
padding: 19px 0;
}
.ds-habit-row + .ds-habit-row {
border-top: 1px solid var(--ds-rule);
}
.ds-habit-main {
display: flex;
align-items: center;
@@ -250,11 +295,11 @@
}
.ds-habit-main h4 {
font-family: var(--ds-serif);
font-size: 27px;
@apply type-title;
}
.ds-habit-main p {
color: var(--ds-secondary);
font-size: 11px;
@apply type-small;
margin-top: 3px;
}
.ds-habit-control {
@@ -265,24 +310,25 @@
.ds-status {
color: var(--ds-secondary);
min-width: 67px;
font-size: 10px;
@apply type-small;
text-align: right;
}
.ds-button {
min-height: 42px;
min-height: 44px;
border: 1px solid var(--ds-ink);
padding: 10px 19px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 22px;
font-size: 12px !important;
gap: 12px;
@apply type-body;
background: var(--ds-ink);
color: var(--ds-paper);
}
.ds-button:hover:not(:disabled) {
background: #333;
}
.ds-button-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.ds-button--secondary {
background: transparent;
color: var(--ds-ink);
@@ -306,7 +352,7 @@
.ds-counter .ds-button {
width: 36px;
min-height: 40px;
font-size: 23px !important;
@apply type-control;
font-weight: 300;
padding: 0;
}
@@ -321,7 +367,7 @@
gap: 11px;
min-height: 36px;
cursor: pointer;
font-size: 12px;
@apply type-small;
}
.ds-checkbox input {
appearance: none;
@@ -373,8 +419,8 @@
font-variant-numeric: tabular-nums;
}
.ds-footnote {
font-size: 11px;
line-height: 1.7;
@apply type-small;
margin-top: 18px !important;
}
.ds-habits > .ds-footnote {
@@ -382,6 +428,58 @@
padding-top: 17px;
margin-top: 0 !important;
}
/* Flat surfaces group content; grid spans are only applied by a bento parent. */
.ds-card-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.ds-card-grid--bento {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ds-card {
min-width: 0;
display: flex;
flex-direction: column;
align-items: stretch;
gap: 24px;
padding: 28px;
border: 1px solid transparent;
border-radius: 0;
box-shadow: none;
overflow-wrap: anywhere;
}
.ds-card--soft { background: #f5f5f5; }
.ds-card--outlined {
background: var(--ds-paper);
border-color: var(--ds-rule);
}
.ds-card-header h3 { @apply type-title; }
.ds-card-header .ds-eyebrow { margin-bottom: 12px; }
.ds-card-body { display: grid; gap: 20px; }
.ds-card-body > p { color: var(--ds-secondary); }
.ds-card-footer { margin-top: auto; }
.ds-card-summary { padding: 12px 0; }
.ds-card-summary > p + p { color: var(--ds-secondary); margin-top: 8px; }
.ds-card .ds-counter { justify-content: flex-start; flex-wrap: wrap; }
.ds-card-grid--bento > :is(.ds-card--wide, .ds-card--featured) { grid-column: span 2; }
.ds-card-grid--bento > .ds-card--featured { grid-row: span 2; }
.ds-container-showcase > .ds-section-heading { max-width: 720px; }
.ds-container-guidance { display: flex; align-items: start; gap: 32px; margin-top: 24px; }
.ds-container-guidance > p { flex: 1; margin-top: 0 !important; }
.ds-container-guidance > button { flex-shrink: 0; }
.ds-container-code { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 24px; }
@media (max-width: 1000px) {
.ds-card-grid--bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ds-card-grid--bento > .ds-card--featured { grid-row: auto; }
}
@media (max-width: 600px) {
.ds-card-grid { grid-template-columns: minmax(0, 1fr); }
.ds-card-grid--bento > :is(.ds-card--wide, .ds-card--featured) { grid-column: auto; }
.ds-card { padding: 24px; }
.ds-container-guidance { flex-direction: column; gap: 12px; }
.ds-container-showcase .ds-spec-heading { align-items: start; flex-direction: column; gap: 8px; }
}
.ds-split-section {
display: grid;
grid-template-columns: 260px minmax(0, 1fr);
@@ -389,14 +487,13 @@
padding-top: 40px;
}
.ds-section-heading h2 {
font-size: 37px;
@apply type-section;
margin-top: 17px;
letter-spacing: -0.5px;
}
.ds-section-heading p {
color: var(--ds-secondary);
font-size: 12px;
line-height: 1.8;
@apply type-small;
margin-top: 15px;
}
.ds-spec-heading {
@@ -408,7 +505,7 @@
}
.ds-spec-heading h3,
.ds-spec-heading label {
font-size: 13px;
@apply type-small;
}
.ds-spec-heading--spaced {
margin-top: 36px;
@@ -416,13 +513,11 @@
.ds-type-display {
display: block;
font-family: var(--ds-serif);
font-size: 55px;
line-height: 1.1;
letter-spacing: -0.6px;
@apply type-display;
}
.ds-type-specimen p,
.ds-body-specimen p {
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
margin-top: 16px;
}
@@ -431,7 +526,7 @@
padding: 26px 0;
}
.ds-body-specimen > span {
font-size: 16px;
@apply type-body;
}
.ds-body-specimen p {
margin-top: 6px;
@@ -448,12 +543,12 @@
border: 1px solid var(--ds-rule);
}
.ds-palette p {
font-size: 11px;
@apply type-small;
margin-top: 10px;
}
.ds-palette .ds-code {
display: block;
font-size: 9px;
@apply type-small;
margin-top: 3px;
}
.ds-spacing {
@@ -470,7 +565,7 @@
background: var(--ds-ink);
}
.ds-spacing code {
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
}
.ds-actions {
@@ -489,7 +584,7 @@
gap: 20px;
}
.ds-component-row h3 {
font-size: 14px;
@apply type-small;
margin-bottom: 3px;
}
.ds-example-form {
@@ -528,12 +623,12 @@
}
.ds-shade-scale small {
color: var(--ds-secondary);
font-size: 10px;
@apply type-small;
}
.ds-scale-caption {
display: flex;
justify-content: space-between;
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
margin-top: 16px;
}
@@ -550,10 +645,10 @@
gap: 13px;
}
.ds-neutral-states h4 {
font-size: 12px;
@apply type-small;
}
.ds-neutral-states p {
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
margin-top: 3px;
}
@@ -582,7 +677,7 @@
display: flex;
justify-content: space-between;
gap: 12px;
font-size: 11px;
@apply type-small;
border-top: 1px solid var(--ds-rule);
padding-top: 15px;
margin-top: 20px;
@@ -596,16 +691,16 @@
gap: 20px;
}
.ds-footer .ds-wordmark {
font-size: 26px;
@apply type-control;
}
.ds-footer > span:nth-child(2) {
font-family: var(--ds-serif);
font-style: italic;
font-size: 20px;
@apply type-lead;
color: var(--ds-secondary);
}
.ds-footer a {
font-size: 11px;
@apply type-small;
}
.ds-detail-count {
display: flex;
@@ -616,11 +711,10 @@
}
.ds-big-value {
font-family: var(--ds-serif);
font-size: 64px;
line-height: 1;
@apply type-display;
}
.ds-big-value small {
font-size: 24px;
@apply type-control;
margin-left: 20px;
}
.ds-chart-selection {
@@ -643,7 +737,7 @@
margin-bottom: 18px;
}
.ds-calendar-range-label {
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
}
.ds-month-views {
@@ -658,7 +752,7 @@
background: transparent;
border: 0;
border-bottom: 1px solid transparent;
font-size: 11px;
@apply type-small;
}
.ds-month-views button:hover {
color: var(--ds-ink);
@@ -675,7 +769,7 @@
display: grid;
grid-template-columns: repeat(26, 1fr);
margin-left: 38px;
font-size: 10px;
@apply type-small;
color: var(--ds-secondary);
height: 28px;
}
@@ -686,9 +780,9 @@
.ds-calendar-weekdays {
display: grid;
grid-template-rows: repeat(7, 1fr);
width: 28px;
width: 36px;
flex-shrink: 0;
font-size: 9px;
@apply type-small;
color: var(--ds-secondary);
align-items: center;
}
@@ -750,7 +844,7 @@
display: flex;
justify-content: space-between;
gap: 16px;
font-size: 10px;
@apply type-small;
margin: 17px 0 23px;
}
.ds-calendar-legend {
@@ -761,7 +855,7 @@
gap: 12px 20px;
margin-top: 18px;
color: var(--ds-secondary);
font-size: 10px;
@apply type-small;
}
.ds-legend-scale,
.ds-legend-neutral,
@@ -789,7 +883,7 @@
display: flex;
justify-content: space-between;
gap: 16px;
font-size: 12px;
@apply type-small;
}
.ds-skip-link {
position: absolute;
@@ -814,9 +908,6 @@
grid-template-columns: 210px minmax(0, 1fr);
gap: 30px;
}
.ds-section-heading h2 {
font-size: 32px;
}
.ds-neutral-states {
flex-direction: column;
gap: 20px;
@@ -840,12 +931,8 @@
padding: 23px 22px;
gap: 18px;
}
.ds-wordmark {
font-size: 30px;
}
.ds-header nav {
gap: 16px;
font-size: 10px;
}
.ds-main {
padding-inline: 22px;
@@ -853,13 +940,6 @@
.ds-intro {
padding: 50px 0 44px;
}
.ds-intro h1 {
font-size: 63px;
letter-spacing: -1.4px;
}
.ds-intro-copy {
font-size: 12px;
}
.ds-intro-note {
display: none;
}
@@ -872,27 +952,17 @@
gap: 16px;
margin-bottom: 24px;
}
.ds-section-top h2 {
font-size: 37px;
}
.ds-split-section {
grid-template-columns: minmax(0, 1fr);
gap: 30px;
}
.ds-section-heading h2 {
font-size: 37px;
}
.ds-section-heading p br {
display: none;
}
.ds-view-switch {
gap: 18px;
}
.ds-view-switch button {
font-size: 11px;
}
.ds-preview-toolbar > .ds-button {
font-size: 10px !important;
gap: 5px;
}
.ds-preview-heading {
@@ -901,23 +971,11 @@
gap: 10px;
padding-top: 25px;
}
.ds-preview-heading h3 {
font-size: 28px;
}
.ds-habit-main h4 {
font-size: 25px;
}
.ds-habit-main p {
font-size: 10px;
}
.ds-habit-control {
flex-direction: column;
gap: 0;
align-items: flex-end;
}
.ds-status {
font-size: 9px;
}
.ds-counter {
gap: 2px;
}
@@ -933,24 +991,15 @@
flex-wrap: wrap;
gap: 3px 20px;
}
.ds-checkbox {
font-size: 11px;
}
.ds-palette {
gap: 13px;
}
.ds-swatch {
height: 58px;
}
.ds-type-display {
font-size: 50px;
}
.ds-shade-scale {
gap: 8px;
}
.ds-scale-caption {
font-size: 9px;
}
.ds-reference-grid {
grid-template-columns: 1fr;
gap: 35px;
@@ -966,11 +1015,7 @@
flex-direction: column;
gap: 8px;
}
.ds-big-value {
font-size: 53px;
}
.ds-big-value small {
font-size: 20px;
margin-left: 10px;
}
.ds-actions {
@@ -982,9 +1027,6 @@
.ds-input-row .ds-button {
padding-inline: 14px;
}
.ds-root {
font-size: 13px;
}
}
@media (prefers-reduced-motion: no-preference) {
.ds-root :where(button, a, input) {
@@ -996,7 +1038,7 @@
/* Habit charts share an open two-column grid, not card containers. */
.ds-habit-chart-grid {
font-size: 14px;
@apply type-small;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 38px 44px;
@@ -1004,9 +1046,12 @@
}
.ds-habit-chart {
min-width: 0;
border-top: 1px solid var(--ds-rule);
padding-top: 20px;
}
.ds-habit-chart:nth-child(n + 3),
.ds-habit-chart:has(.ds-calendar[data-months="12"]) + .ds-habit-chart {
border-top: 1px solid var(--ds-rule);
}
.ds-habit-chart:has(.ds-calendar[data-months="12"]) {
grid-column: 1 / -1;
}
@@ -1022,7 +1067,7 @@
.ds-habit-chart-heading h4 {
overflow-wrap: anywhere;
font-family: var(--ds-serif);
font-size: 29px;
@apply type-title;
display: flex;
align-items: center;
gap: 10px;
@@ -1034,7 +1079,7 @@
}
.ds-habit-chart-heading p {
color: var(--ds-secondary);
font-size: 10px;
@apply type-small;
margin-top: 4px;
}
.ds-habit-chart-heading .ds-counter {
@@ -1047,7 +1092,7 @@
display: flex;
justify-content: space-between;
color: var(--ds-secondary);
font-size: 11px;
@apply type-small;
margin: 23px 0 20px !important;
}
.ds-habit-chart-grid-note {
@@ -1063,12 +1108,12 @@
.ds-calendar--compact .ds-date-inspector {
flex-direction: column;
gap: 5px;
font-size: 10px;
@apply type-small;
border-bottom: 0;
padding-bottom: 0;
}
.ds-calendar--compact .ds-calendar-caption {
font-size: 9px;
@apply type-small;
margin-bottom: 15px;
}
.ds-task-accordion {
@@ -1083,7 +1128,7 @@
gap: 16px;
align-items: center;
min-height: 46px;
font-size: 12px;
@apply type-small;
}
.ds-task-accordion summary::-webkit-details-marker {
display: none;
@@ -1091,11 +1136,11 @@
.ds-task-accordion summary > span {
margin-left: auto;
color: var(--ds-secondary);
font-size: 11px;
@apply type-small;
}
.ds-task-accordion summary::after {
content: "+";
font-size: 19px;
@apply type-lead;
width: 16px;
text-align: center;
}
@@ -1115,7 +1160,7 @@
display: flex;
align-items: center;
gap: 9px;
font-size: 11px;
@apply type-small;
text-transform: capitalize;
}
.ds-habit-color-key i {
@@ -1123,6 +1168,9 @@
height: 10px;
}
@media (max-width: 760px) {
.ds-habit-chart + .ds-habit-chart {
border-top: 1px solid var(--ds-rule);
}
.ds-habit-chart-grid {
grid-template-columns: minmax(0, 1fr);
gap: 32px;
@@ -1145,58 +1193,23 @@
gap: clamp(2px, 0.4vw, 6px);
}
/* Small-text scale: 12px minimum, 14px for supporting copy. */
.ds-edition,
.ds-preview-heading .ds-eyebrow,
.ds-palette .ds-code,
.ds-calendar-weekdays,
.ds-calendar--compact .ds-calendar-caption {
font-size: 12px;
}
.ds-code,
.ds-demo-note,
.ds-habit-main p,
.ds-footnote,
.ds-palette p,
.ds-reference-grid figcaption,
.ds-footer a,
.ds-month-views button,
.ds-habit-chart-progress,
.ds-task-accordion summary > span,
.ds-habit-color-key > span,
.ds-eyebrow,
.ds-status,
.ds-type-specimen p,
.ds-body-specimen p,
.ds-spacing code,
.ds-shade-scale small,
.ds-scale-caption,
.ds-neutral-states p,
.ds-calendar-range-label,
.ds-calendar-months,
.ds-calendar-caption,
.ds-calendar-legend,
.ds-habit-chart-heading p,
.ds-calendar--compact .ds-date-inspector {
font-size: 14px;
}
.ds-legend-scale { flex-wrap: wrap; }
/* Editing patterns use the same open layout, rules, and neutral controls. */
.ds-color-picker { border: 0; border-top: 1px solid var(--ds-rule); padding: 20px 0 0; margin: 26px 0; min-width: 0; }
.ds-color-picker legend { padding: 0 12px 0 0; font-size: 14px; }
.ds-color-picker legend { padding: 0 12px 0 0; @apply type-small; }
.ds-color-picker > .ds-footnote { margin-top: 0 !important; }
.ds-color-palettes { display: flex; flex-wrap: wrap; gap: 20px 28px; margin: 20px 0; }
.ds-color-palette > span { font-size: 12px; color: var(--ds-secondary); }
.ds-color-palette > span { @apply type-small; color: var(--ds-secondary); }
.ds-color-swatches { display: flex; gap: 4px; margin-top: 8px; }
.ds-color-swatches button { width: 38px; min-height: 44px; padding: 4px; border: 1px solid transparent; background: transparent; }
.ds-color-swatches button[aria-pressed="true"] { border-color: var(--ds-ink); }
.ds-color-swatches button > span { display: grid; place-content: center; height: 28px; width: 28px; color: white; font-size: 16px; }
.ds-color-swatches button > span { display: grid; place-content: center; height: 28px; width: 28px; color: white; @apply type-body; }
.ds-custom-color { display: flex; gap: 16px; align-items: start; }
.ds-custom-color .ds-field { margin-bottom: 0; }
.ds-custom-color .ds-field:last-child { width: 180px; }
.ds-custom-color input[type="color"] { width: 80px; height: 44px; padding: 5px; cursor: pointer; }
.ds-color-live-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 22px; font-size: 12px; }
.ds-color-live-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 22px; @apply type-small; }
.ds-color-preview-shades { display: flex; gap: 4px; }
.ds-color-preview-shades > span { width: 18px; height: 18px; border: 1px solid #dedede; }
.ds-edit-layout {
@@ -1208,16 +1221,15 @@
.ds-edit-context, .ds-edit-content { min-width: 0; }
.ds-edit-context h3 {
font-family: var(--ds-serif);
font-size: 36px;
line-height: 1.12;
@apply type-title;
margin: 16px 0;
}
.ds-edit-context > p { color: var(--ds-secondary); line-height: 1.8; }
.ds-edit-context > p { color: var(--ds-secondary); }
.ds-edit-context > .ds-field { margin-top: 30px; }
.ds-edit-meta { display: flex; align-items: center; gap: 10px; margin-top: 24px; overflow-wrap: anywhere; }
.ds-habit-dot { width: 8px; height: 8px; flex: 0 0 8px; }
.ds-field { display: grid; min-width: 0; gap: 8px; margin-bottom: 22px; }
.ds-field label, .ds-weekday-field legend { font-size: 14px; }
.ds-field label, .ds-weekday-field legend { @apply type-small; }
.ds-field :is(input, select) {
width: 100%;
min-width: 0;
@@ -1225,21 +1237,22 @@
border: 1px solid #999;
padding: 10px 12px;
font: inherit;
@apply type-body;
border-radius: 0;
background: var(--ds-paper);
color: var(--ds-ink);
}
.ds-field input[readonly] { border-color: var(--ds-rule); color: var(--ds-secondary); }
.ds-field small { font-size: 12px; color: var(--ds-secondary); line-height: 1.7; }
.ds-field small { @apply type-small; color: var(--ds-secondary); }
.ds-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ds-form-section { border-top: 1px solid var(--ds-rule); padding-top: 24px; margin-top: 24px; }
.ds-edit-content .ds-checkbox { font-size: 14px; }
.ds-edit-content .ds-checkbox { @apply type-small; }
.ds-weekday-field, .ds-task-editor-fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.ds-weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ds-weekdays button { min-height: 44px; min-width: 44px; padding: 8px; border: 1px solid var(--ds-rule); background: white; color: var(--ds-secondary); }
.ds-weekdays button[aria-pressed="true"] { color: white; background: var(--ds-ink); border-color: var(--ds-ink); }
.ds-form-actions { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.ds-form-feedback { min-height: 24px; margin: 20px 0 12px !important; color: var(--ds-secondary); font-size: 14px; overflow-wrap: anywhere; }
.ds-form-feedback { min-height: 24px; margin: 20px 0 12px !important; color: var(--ds-secondary); @apply type-small; overflow-wrap: anywhere; }
.ds-form-feedback[role="alert"] { border-left: 2px solid var(--ds-ink); padding-left: 12px; color: var(--ds-ink); }
.ds-save-notice { margin-bottom: 0 !important; }
.ds-edit-task { border-top: 1px solid var(--ds-rule); padding: 16px 0 10px; }
@@ -1254,7 +1267,7 @@
.ds-backfill-calendar { border-top: 1px solid var(--ds-rule); margin-top: 32px; padding-top: 24px; }
.ds-correction-log { margin-top: 28px; border-top: 1px solid var(--ds-rule); padding-top: 24px; }
.ds-correction-log ol { list-style: none; margin: 0; padding: 0; }
.ds-correction-log li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 16px; border-bottom: 1px solid var(--ds-rule); padding: 16px 0; font-size: 14px; overflow-wrap: anywhere; }
.ds-correction-log li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 16px; border-bottom: 1px solid var(--ds-rule); padding: 16px 0; @apply type-small; overflow-wrap: anywhere; }
.ds-correction-log time { color: var(--ds-secondary); }
#editing .ds-preview-toolbar { flex-wrap: wrap; gap: 0 16px; }
#editing .ds-view-switch { flex-wrap: wrap; gap: 0 24px; }
@@ -1263,22 +1276,12 @@
}
@media (max-width: 640px) {
.ds-edit-layout { grid-template-columns: minmax(0, 1fr); gap: 30px; }
.ds-edit-context h3 { font-size: 32px; }
.ds-form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.ds-history-requirement { flex-wrap: wrap; }
.ds-correction-log li { grid-template-columns: minmax(0, 1fr); gap: 5px; }
#editing .ds-view-switch { gap: 0 18px; }
}
@media (max-width: 640px) {
.ds-header nav,
.ds-preview-toolbar > .ds-button,
.ds-view-switch button,
.ds-checkbox,
.ds-habit-main p,
.ds-status,
.ds-scale-caption {
font-size: 14px !important;
}
.ds-header,
.ds-preview-toolbar { flex-wrap: wrap; }
}

View File

@@ -3,6 +3,8 @@
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities);
@import "tw-animate-css";
@import "./typography.css";
@import "./design-system.css" layer(components);
@custom-variant dark (&:is(.dark *));

View File

@@ -1,603 +0,0 @@
.home-root {
font-size: 15px;
}
.home-root .ds-eyebrow {
font-size: 10px;
}
.home-root .ds-button {
font-size: 13px !important;
}
.home-header nav {
font-size: 13px;
}
.home-header nav [aria-current] {
border-bottom: 1px solid var(--ds-ink);
padding-bottom: 5px;
}
.home-account {
display: flex;
align-items: center;
gap: 12px;
min-width: 0;
}
.home-avatar {
display: grid;
place-items: center;
background: #f1f0ed;
width: 30px;
height: 30px;
flex-shrink: 0;
border-radius: 50%;
font-family: var(--ds-serif);
font-size: 19px;
}
.home-avatar:is(img) {
object-fit: cover;
}
.home-account-name {
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
}
.home-account .ds-button {
margin-left: 12px;
white-space: nowrap;
}
.home-welcome {
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 40px;
padding: 64px 0 48px;
}
.home-welcome > div:first-child {
min-width: 0;
}
.home-welcome h1 {
font-size: clamp(52px, 6vw, 78px);
letter-spacing: -1.7px;
margin: 18px 0 22px;
overflow-wrap: anywhere;
}
.home-welcome .ds-intro-copy {
max-width: 480px;
}
.home-date {
flex: 0 0 235px;
font-size: 13px;
padding-bottom: 5px;
}
.home-date .ds-tiny-cross {
margin-bottom: 14px;
}
.home-date p {
color: var(--ds-secondary);
margin: 5px 0 17px;
font-size: 12px;
overflow-wrap: anywhere;
}
.home-date .ds-footnote {
font-size: 12px;
}
.home-overview {
display: grid;
grid-template-columns: 1fr 1fr 1.7fr;
border-top: 1px solid var(--ds-rule);
padding: 28px 0 34px;
gap: 32px;
}
.home-overview > div + div {
border-left: 1px solid var(--ds-rule);
padding-left: 32px;
}
.home-overview p:not(.home-stat) {
color: var(--ds-secondary);
font-size: 12px;
}
.home-stat {
font-family: var(--ds-serif);
font-size: 54px;
line-height: 1;
margin: 18px 0 10px !important;
}
.home-stat span {
color: #777;
font-size: 32px;
}
.home-overview progress {
display: block;
height: 3px;
margin-top: 18px;
width: 100%;
max-width: 185px;
border: 0;
background: #eee;
accent-color: #111;
}
.home-overview progress::-webkit-progress-bar {
background: #eee;
}
.home-overview progress::-webkit-progress-value {
background: #111;
}
.home-overview-note h2 {
font-size: 32px;
margin: 19px 0 13px;
}
.home-overview-note p {
max-width: 280px;
line-height: 1.8;
}
.home-today {
padding-top: 34px;
}
.home-empty > p:first-child {
font-size: 17px;
margin-bottom: 9px;
}
.home-empty > .ds-muted {
max-width: 610px;
font-size: 14px;
line-height: 1.8;
}
.home-starters {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 28px;
margin-top: 32px;
}
.home-starters > button {
background: transparent;
border: 0;
border-top: 1px solid var(--ds-rule);
border-bottom: 1px solid var(--ds-rule);
text-align: left;
color: var(--ds-ink);
padding: 22px 4px 18px;
font: inherit;
}
.home-starters > button:hover {
background: #fafaf8;
}
.home-starter-symbol {
font-family: var(--ds-serif);
font-size: 27px;
display: block;
margin-bottom: 20px;
}
.home-starters h3 {
font-family: var(--ds-serif);
font-size: 28px;
margin-bottom: 9px;
}
.home-starters p {
color: var(--ds-secondary);
font-size: 13px;
min-height: 40px;
}
.home-starter-action {
display: flex;
justify-content: space-between;
margin-top: 24px;
font-size: 12px;
}
.home-root .ds-view-switch button {
font-size: 13px;
}
.home-root .ds-view-switch button span {
font-size: 11px;
color: var(--ds-secondary);
margin-left: 8px;
}
.home-autosave {
align-self: center;
color: var(--ds-secondary);
font-size: 11px;
}
.home-habit {
padding: 12px 0;
border-bottom: 1px solid var(--ds-rule);
}
.home-habit-heading {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
}
.home-habit-heading > div:first-child {
min-width: 0;
}
.home-habit .ds-eyebrow {
color: var(--ds-secondary);
font-size: 9px;
}
.home-habit h3 {
font-family: var(--ds-serif);
font-size: 24px;
line-height: 1.15;
margin: 0 0 4px;
overflow-wrap: anywhere;
}
.home-habit-status {
font-size: 11px;
color: var(--ds-secondary);
}
.home-habit--complete .home-habit-status {
color: #386641;
}
.home-check-in {
display: flex;
align-items: center;
gap: 16px;
flex-shrink: 0;
}
.home-check-in .ds-checkbox span {
max-width: 250px;
overflow-wrap: anywhere;
}
.home-task-count {
font-family: var(--ds-serif);
font-size: 26px;
}
.home-task-count > span {
color: var(--ds-secondary);
font-size: 20px;
}
.home-history-link {
display: grid;
place-items: center;
width: 32px;
min-height: 44px;
color: var(--ds-secondary);
}
.home-task-details {
margin-top: 6px;
font-size: 12px;
}
.home-task-details summary {
cursor: pointer;
padding: 4px 0;
}
.home-task-details summary span {
color: var(--ds-secondary);
margin-left: 8px;
}
.home-tasks {
display: flex;
flex-wrap: wrap;
gap: 6px 24px;
margin-top: 8px;
}
.home-tasks .ds-checkbox {
min-height: 36px;
}
.home-tasks .ds-checkbox span {
overflow-wrap: anywhere;
}
.home-count-entry {
font-size: 11px;
color: var(--ds-secondary);
margin-top: 6px;
}
.home-count-entry summary,
.home-off-day summary {
cursor: pointer;
}
.home-count-entry form {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
padding: 12px 0;
}
.home-count-entry input {
width: 120px;
padding: 10px;
border: 1px solid var(--ds-rule);
}
.home-off-day {
margin-top: 26px;
}
.home-off-day summary {
font-size: 14px;
}
.home-off-day summary > span {
margin-left: 8px;
color: var(--ds-secondary);
font-size: 12px;
}
.home-off-day > p {
margin-top: 16px;
}
.home-off-day > div {
display: flex;
justify-content: space-between;
align-items: center;
gap: 24px;
padding: 16px 0;
border-bottom: 1px solid var(--ds-rule);
}
.home-off-day strong {
font-weight: 400;
overflow-wrap: anywhere;
}
.home-off-day small {
display: block;
color: var(--ds-secondary);
margin-top: 4px;
}
.home-off-day a {
flex-shrink: 0;
font-size: 12px;
}
.home-rhythm > .ds-footnote {
margin-top: 24px;
font-size: 12px;
}
.home-state {
padding: 36px 0;
color: var(--ds-secondary);
}
.home-state h3 {
font-family: var(--ds-serif);
font-size: 30px;
color: var(--ds-ink);
margin-bottom: 10px;
}
.home-state .ds-button {
margin-top: 16px;
}
.home-error {
border-left: 2px solid #963e33;
padding: 12px 16px;
background: #fcf6f3;
margin-bottom: 20px !important;
color: #772d25;
}
.home-error .ds-button {
margin-top: 12px;
}
.home-notice {
font-size: 12px;
color: #386641;
}
.home-notice:not(:empty) {
padding: 0 0 20px;
}
.home-footer {
margin-top: 12px;
}
.home-habit-actions {
display: flex;
align-items: center;
gap: 16px;
flex-shrink: 0;
}
.home-habit-actions .ds-button {
min-height: 36px;
padding: 0;
color: var(--ds-secondary);
}
.home-habit-actions .ds-button:hover {
color: var(--ds-ink);
}
.home-create {
color: var(--ds-ink);
background: var(--ds-paper);
border: 1px solid var(--ds-rule);
padding: 28px 32px;
width: min(560px, calc(100% - 32px));
max-height: calc(100dvh - 48px);
overflow-y: auto;
}
.home-create::backdrop {
background: rgb(0 0 0 / 35%);
}
.home-delete {
max-width: 520px;
}
.home-delete h2 {
margin-top: 20px;
}
.home-delete strong {
color: var(--ds-ink);
overflow-wrap: anywhere;
}
.home-create-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.home-create-heading .ds-button {
font-size: 26px !important;
min-width: 36px;
}
.home-create h2 {
font-size: 46px;
margin: 8px 0 14px;
}
.home-create > .ds-muted {
font-size: 13px;
}
.home-form-fields {
border: 0;
margin: 24px 0;
padding: 0;
display: grid;
gap: 22px;
min-width: 0;
}
.home-form-fields .ds-field {
min-width: 0;
}
.home-form-fields textarea {
resize: vertical;
width: 100%;
border: 1px solid var(--ds-rule);
padding: 10px 12px;
font: inherit;
}
.home-form-actions {
display: flex;
justify-content: flex-end;
gap: 12px;
border-top: 1px solid var(--ds-rule);
padding-top: 22px;
}
@media (max-width: 900px) {
.home-header {
flex-wrap: wrap;
}
.home-header nav {
order: 3;
flex-basis: 100%;
}
.home-welcome {
gap: 24px;
}
.home-date {
flex-basis: 190px;
}
.home-overview {
gap: 20px;
}
.home-overview > div + div {
padding-left: 20px;
}
.home-starters {
gap: 18px;
}
}
@media (max-width: 680px) {
.home-header {
padding: 22px 24px;
gap: 20px;
}
.home-header nav {
justify-content: space-between;
gap: 20px;
}
.home-account-name {
display: none;
}
.home-account {
gap: 8px;
}
.home-account .ds-button {
margin-left: 0;
}
.home-root .ds-main {
padding: 0 24px;
}
.home-welcome {
display: block;
padding: 30px 0 24px;
}
.home-welcome h1 {
font-size: clamp(46px, 10vw, 60px);
margin: 14px 0;
}
.home-date {
display: flex;
flex-wrap: wrap;
gap: 4px 10px;
margin-top: 18px;
padding: 0;
font-size: 12px;
}
.home-date .ds-tiny-cross,
.home-date > span:last-child {
display: none;
}
.home-date p {
margin: 0;
}
.home-overview {
grid-template-columns: 1fr 1fr;
gap: 18px;
padding: 20px 0;
}
.home-overview > .home-overview-note {
grid-column: 1 / -1;
border-left: 0;
border-top: 1px solid var(--ds-rule);
padding: 16px 0 0;
}
.home-overview-note .ds-eyebrow {
display: none;
}
.home-overview-note h2 {
font-size: 28px;
margin: 0 0 8px;
}
.home-overview-note p {
max-width: none;
}
.home-root .ds-section-top {
align-items: flex-start;
flex-direction: column;
gap: 24px;
}
.home-root .ds-section-top h2 {
font-size: 38px;
}
.home-starters {
grid-template-columns: 1fr;
gap: 0;
}
.home-starters > button {
padding: 22px 0;
border-bottom: 0;
}
.home-starters > button:last-child {
border-bottom: 1px solid var(--ds-rule);
}
.home-starter-symbol {
float: right;
margin: 0;
}
.home-starters p {
min-height: 0;
}
.home-starter-action {
margin-top: 18px;
}
.home-autosave {
display: none;
}
.home-habit-heading {
flex-wrap: wrap;
gap: 8px 12px;
}
.home-habit h3 {
font-size: 23px;
}
.home-check-in {
margin-left: auto;
gap: 8px;
}
.home-check-in .ds-checkbox span {
max-width: none;
}
.home-tasks {
flex-direction: column;
gap: 6px;
margin-top: 12px;
}
.home-create {
padding: 20px;
}
.home-create .ds-form-grid {
grid-template-columns: 1fr;
}
.home-create .ds-weekdays {
flex-wrap: wrap;
}
.home-footer {
flex-wrap: wrap;
}
}

View File

@@ -1,64 +0,0 @@
.landing-root { font-size: 16px; }
.landing-root .ds-eyebrow { font-size: 11px; }
.landing-root .ds-button { font-size: 14px !important; }
.landing-header nav { font-size: 14px; }
.landing-header > .ds-button { gap: 24px; }
.landing-hero { padding: 88px 0 80px; }
.landing-hero h1 { font-size: clamp(64px, 7.5vw, 100px); }
.landing-hero .ds-intro-copy { max-width: 580px; font-size: 16px; }
.landing-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; margin-top: 30px; }
.landing-text-link { display: inline-flex; align-items: center; gap: 20px; padding: 10px 0; font-size: 14px; }
.landing-signin-note { margin-top: 14px !important; color: var(--ds-secondary); font-size: 12px; }
.landing-hero-note { flex: 0 0 200px; padding-bottom: 43px; font-size: 14px; }
.landing-root .ds-demo-note { font-size: 12px; white-space: normal; }
.landing-root .ds-footnote { font-size: 13px; }
.landing-root .ds-preview-heading .ds-eyebrow { font-size: 11px; }
.landing-root .ds-preview-heading > p { font-size: 13px; }
.landing-root .ds-view-switch button { font-size: 14px; }
.landing-root .ds-counter .ds-button { font-size: 23px !important; }
.landing-demo-hint { max-width: 740px; }
.landing-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px; list-style: none; padding: 0; margin: 44px 0 24px; }
.landing-steps li { border-top: 1px solid var(--ds-rule); padding-top: 22px; }
.landing-steps .ds-eyebrow { color: var(--ds-secondary); }
.landing-steps h3 { font-family: var(--ds-serif); font-size: 29px; line-height: 1.15; margin: 22px 0 14px; }
.landing-steps p, .landing-discord-copy > p { color: var(--ds-secondary); line-height: 1.8; }
.landing-discord { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; padding-top: 56px; padding-bottom: 64px; }
.landing-discord h2 { font-size: clamp(38px, 4.5vw, 56px); margin-top: 24px; }
.landing-discord-copy { padding-top: 4px; }
.landing-discord-details { margin: 30px 0 0; }
.landing-discord-details > div { border-top: 1px solid var(--ds-rule); padding: 18px 0; }
.landing-discord-details dt { margin-bottom: 6px; font-size: 14px; }
.landing-discord-details dd { margin: 0; color: var(--ds-secondary); font-size: 14px; line-height: 1.7; }
.landing-closing { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 56px 0 64px; }
.landing-closing h2 { font-size: clamp(44px, 5.5vw, 64px); margin-top: 22px; }
.landing-closing > div:last-child { text-align: right; }
.landing-footer { font-size: 13px; }
.landing-auth-error { border-bottom: 1px solid var(--ds-rule); padding: 20px 0; font-size: 14px; }
.landing-account-state { max-width: 600px; margin: auto; padding: 96px 24px; }
.landing-account-state p { margin: 32px 0 20px; color: var(--ds-secondary); }
@media (max-width: 900px) {
.landing-hero-note { flex-basis: 160px; }
.landing-steps { gap: 24px; }
.landing-discord { gap: 32px; }
}
@media (max-width: 680px) {
.landing-header { flex-wrap: wrap; gap: 20px; padding: 22px 24px; }
.landing-header nav { order: 3; flex-basis: 100%; justify-content: space-between; gap: 16px; }
.landing-root .ds-main { padding: 0 24px; }
.landing-hero { padding: 52px 0; }
.landing-hero h1 { font-size: clamp(54px, 12vw, 78px); letter-spacing: -1.5px; }
.landing-hero-note { display: none; }
.landing-desktop-break { display: none; }
.landing-root .ds-section-top { align-items: flex-start; }
.landing-root .ds-section-top h2 { font-size: 38px; }
.landing-root .ds-preview-toolbar { flex-wrap: wrap; gap: 8px 20px; }
.landing-root .ds-view-switch { gap: 20px; }
.landing-root .ds-preview-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
.landing-steps { grid-template-columns: 1fr; gap: 28px; margin-top: 32px; }
.landing-steps h3 { margin-top: 14px; }
.landing-discord { grid-template-columns: 1fr; gap: 28px; padding: 40px 0; }
.landing-closing { align-items: flex-start; flex-direction: column; padding: 40px 0; }
.landing-closing > div:last-child { text-align: left; }
.landing-footer { flex-wrap: wrap; gap: 20px; }
}

55
styles/typography.css Normal file
View File

@@ -0,0 +1,55 @@
/* Fixed rem steps respect browser text-size preferences. No viewport-based type.
Use these utilities directly in JSX or @apply them in shared components. */
@theme {
--text-copy: 1rem;
--text-copy--line-height: 1.5;
--text-caption: 0.875rem;
--text-caption--line-height: 1.5;
--text-lead: 1.25rem;
--text-lead--line-height: 1.5;
--text-title: 2rem;
--text-title--line-height: 1.25;
--text-section: 3rem;
--text-section--line-height: 1.125;
--text-display: 4.5rem;
--text-display--line-height: 1.125;
}
@utility type-body { @apply text-copy; }
@utility type-small { @apply text-caption; }
@utility type-label {
@apply text-caption;
font-weight: 500;
letter-spacing: 0.08em;
}
@utility type-eyebrow {
font-size: 0.75rem;
line-height: 1.5;
font-weight: 400;
letter-spacing: 0.08em;
}
@utility type-lead { @apply text-lead; }
@utility type-title {
@apply text-title;
font-family: var(--ds-serif);
font-weight: 400;
letter-spacing: -0.02em;
}
@utility type-section {
@apply text-section;
font-family: var(--ds-serif);
font-weight: 400;
letter-spacing: -0.02em;
@media (max-width: 40rem) { font-size: 2.25rem; line-height: 1.25; }
}
@utility type-display {
@apply text-display;
font-family: var(--ds-serif);
font-weight: 400;
letter-spacing: -0.025em;
@media (max-width: 40rem) { font-size: 3rem; line-height: 1.125; }
}
@utility type-control {
font-size: 1.5rem;
line-height: 1.25;
}

38
styles/typography.test.ts Normal file
View File

@@ -0,0 +1,38 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
const css = (name: string) => readFileSync(new URL(name, import.meta.url), "utf8");
describe("shared typography contract", () => {
test("all component and page styles use the fixed shared type utilities", () => {
for (const file of ["design-system.css"]) {
const source = css(file);
expect(source).not.toMatch(/font-size\s*:/);
expect(source).not.toMatch(/font:\s*\d/);
expect(source).toContain("@apply type-");
}
const typography = css("typography.css");
expect(typography).not.toMatch(/clamp\(|\d(?:vw|vh|px)\b/);
expect(typography).toContain("--text-copy: 1rem");
expect(typography).toContain("--text-caption: 0.875rem");
for (const role of ["body", "small", "label", "lead", "title", "section", "display", "control"]) {
expect(typography).toContain(`@utility type-${role}`);
}
});
test("text colors meet WCAG AA normal-text contrast on paper", () => {
const source = css("design-system.css");
const luminance = (token: string) => {
let hex = source.match(new RegExp(`--ds-${token}: #([\\da-f]+);`))![1]!;
if (hex.length === 3) hex = [...hex].map((c) => c + c).join("");
const channels = [0, 2, 4].map((start) => {
const value = parseInt(hex.slice(start, start + 2), 16) / 255;
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
});
return channels[0]! * 0.2126 + channels[1]! * 0.7152 + channels[2]! * 0.0722;
};
for (const color of ["ink", "secondary"]) {
expect((luminance("paper") + 0.05) / (luminance(color) + 0.05)).toBeGreaterThanOrEqual(4.5);
}
});
});