body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

a {
    color: var(--color-pink-500);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-pink-600);
}

strong { font-weight: var(--weight-semibold); }

small {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

hr {
    border: none;
    height: 1px;
    background-color: var(--color-border);
    margin: var(--space-6) 0;
}

::selection {
    background-color: var(--color-pink-200);
    color: var(--color-text-primary);
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 640px) {
    .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
    .container { padding: 0 var(--space-8); }
}

/* Section spacing */
.section {
    padding: var(--space-10) 0;
}

@media (min-width: 1024px) {
    .section { padding: var(--space-16) 0; }
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-6);
    text-align: center;
}

/* Grid system */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .grid { gap: var(--space-5); }
}

@media (min-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .grid { gap: var(--space-6); }
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Spacing */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Text utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-pink { color: var(--color-pink-500); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.font-display { font-family: var(--font-display); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

/* Icon sizing */
.icon {
    display: inline-flex;
    width: 1.25em;
    height: 1.25em;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
}

.icon-sm {
    width: 1em;
    height: 1em;
}

.icon-lg {
    width: 1.5em;
    height: 1.5em;
}

/* Visually hidden (accessible) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Page wrapper for sticky footer */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--header-height) + 24px);
}

html.dark-mode { color-scheme: dark; }
html.dark-mode ::selection {
    background-color: var(--color-pink-700);
    color: #fff;
}
html.dark-mode hr { background-color: var(--color-border); }
