/* Base Typography */
body {
    color: var(--md-sys-color-on-surface);
}

/* Paragraph styling */
p {
    font-size: 1.6rem;
    line-height: 1.6;
    margin-bottom: 1.5em;
    max-width: 90ch;
}

/* Responsive paragraph adjustments */
@media (max-width: 768px) {
    p {
        font-size: 1.5rem;
    }
}

/* Enhanced Heading Hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--md-sys-color-on-background);
}

h1 {
    font-size: 3.2rem;
    margin-top: 0;
}

h2 {
    font-size: 2.4rem;
}

h3 {
    font-size: 2rem;
}

h4 {
    font-size: 1.8rem;
}

h5 {
    font-size: 1.6rem;
    font-weight: 700;
}

h6 {
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Text utility classes - typography related */
.text-small {
    font-size: 1.2rem;
    line-height: 1.2;
}

.text-large {
    font-size: 1.25rem;
    line-height: 1.4;
}

.text-bold {
    font-weight: bold;
}

.text-italic {
    font-style: italic;
}

.text-underline {
    text-decoration: underline;
}

/* Enhanced readable-text class */
.readable-text {
    font-family: Georgia, serif;
    font-size: 1.7rem;
    line-height: 1.6;
    max-width: 70ch;
    margin-bottom: 1.5em;
    color: var(--md-sys-color-on-surface);
}

/* For lighter backgrounds */
@media (prefers-color-scheme: light) {
    .readable-text {
        color: color-mix(in oklab, var(--md-sys-color-on-surface) 80%, var(--md-sys-color-surface));
    }
}

/* For darker backgrounds */
@media (prefers-color-scheme: dark) {
    .readable-text {
        color: color-mix(in oklab, var(--md-sys-color-on-surface) 90%, var(--md-sys-color-surface));
    }
}

/* Link styling - typography aspect */
a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    text-underline-offset: 0.15em;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover, a:focus {
    text-decoration: underline;
    text-decoration-thickness: 0.1em;
    text-decoration-color: currentColor;
}

/* Code and pre styling */
code, pre {
    font-family: "Consolas", "Monaco", "Andale Mono", monospace;
    font-size: 1.4rem;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: 3px;
}

code {
    padding: 0.2em 0.4em;
}

pre {
    padding: 1em;
    overflow-x: auto;
    line-height: 1.4;
}

/* List typography */
article ul,
article ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

article li {
    margin-bottom: 0.5em;
}

/* Table typography */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    font-size: 1.5rem;
}

th, td {
    padding: 0.8em;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    text-align: left;
}

th {
    font-weight: 600;
    border-bottom-width: 2px;
}

/* High-contrast mode support */
@media (prefers-contrast: more), (-ms-high-contrast: active) {
    body {
        color: #000000;
    }

    a {
        text-decoration: underline !important;
        text-underline-offset: 0.2em;
    }
}