/* =====================================================
   MODULE: TYPOGRAPHY
   Headings, body text, code, blockquotes, lists,
   text utilities, scrollbar styling.
   Full per-theme overrides for all 4 themes.
   Toggle: modules.typography in theme-config.json
   ===================================================== */

/* ============= HEADINGS ============= */
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5em 0;
}
.h1 { font-size: var(--font-size-4xl, 2.25rem); font-weight: 800; letter-spacing: -0.02em; }
.h2 { font-size: var(--font-size-3xl, 1.875rem); font-weight: 700; letter-spacing: -0.01em; }
.h3 { font-size: var(--font-size-2xl, 1.5rem); }
.h4 { font-size: var(--font-size-xl, 1.25rem); }
.h5 { font-size: var(--font-size-lg, 1.125rem); }
.h6 { font-size: var(--font-size-base, 1rem); }

/* ============= DISPLAY TEXT (bigger than h1, for hero numbers/KPIs) ============= */
.display-1, .display-2, .display-3, .display-4 {
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 0.5em 0;
}
.display-1 { font-size: var(--font-size-display-1, 6rem); }
.display-2 { font-size: var(--font-size-display-2, 4.5rem); }
.display-3 { font-size: var(--font-size-display-3, 3.5rem); }
.display-4 { font-size: var(--font-size-display-4, 2.75rem); }

.display-accent { color: var(--accent); }
.display-glow {
    text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3), 0 0 40px rgba(var(--accent-rgb), 0.15);
}

/* ============= BODY TEXT ============= */
.text-body {
    font-size: var(--font-size-base, 1rem);
    color: var(--text-primary);
    line-height: 1.6;
}
.text-lead {
    font-size: var(--font-size-lg, 1.125rem);
    color: var(--text-secondary);
    line-height: 1.6;
}
.text-small, .text-sm {
    font-size: var(--font-size-sm, 0.875rem);
}
.text-xs {
    font-size: var(--font-size-xs, 0.75rem);
}

/* ============= TEXT COLORS ============= */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-muted     { color: var(--text-disabled); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--color-success); }
.text-danger    { color: var(--color-danger); }
.text-warning   { color: var(--color-warning); }
.text-info      { color: var(--color-info); }

/* ============= LINKS ============= */
.link {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast, 150ms);
}
.link:hover { color: var(--accent-hover); text-decoration: underline; }
.link-subtle {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-subtle:hover { color: var(--text-primary); }

/* ============= BLOCKQUOTE ============= */
.blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-accent-subtle);
    border-radius: 0 var(--radius-md, 0.5rem) var(--radius-md, 0.5rem) 0;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
}
.blockquote-footer {
    margin-top: 0.5rem;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-tertiary);
    font-style: normal;
}

/* ============= INLINE CODE ============= */
.code, code:not(pre code) {
    padding: 0.15rem 0.35rem;
    font-size: 0.85em;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm, 0.25rem);
    color: var(--accent);
    word-break: break-word;
}

/* ============= CODE BLOCK ============= */
.code-block, pre {
    margin: 1rem 0;
    padding: 1rem;
    font-size: var(--font-size-sm, 0.875rem);
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg, 0.75rem);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: auto;
    tab-size: 4;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg, 0.75rem) var(--radius-lg, 0.75rem) 0 0;
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-tertiary);
    font-weight: 600;
}

/* ============= LISTS ============= */
.list {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.8;
}
.list li { padding: 0.125rem 0; }
.list-none { list-style: none; padding-left: 0; }
.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }
.list-check li {
    list-style: none;
    position: relative;
    padding-left: 1.5rem;
}
.list-check li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: 700;
}

/* ============= DEFINITION LIST ============= */
.dl { margin: 0.5rem 0; }
.dl dt {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.75rem;
}
.dl dd {
    color: var(--text-secondary);
    margin-left: 0;
    padding-left: 1rem;
    border-left: 2px solid var(--border-secondary);
}

/* ============= HORIZONTAL RULE (also in dividers.css) ============= */
.hr {
    border: none;
    height: 1px;
    background: var(--divider);
    margin: 1.5rem 0;
}

/* ============= TEXT UTILITIES ============= */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-break  { word-break: break-word; overflow-wrap: break-word; }
.font-mono { font-family: "SF Mono", "Fira Code", monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ============= SELECTION ============= */
::selection {
    background: rgba(var(--accent-rgb), 0.3);
    color: var(--text-primary);
}

/* ============= KEYBOARD SHORTCUT ============= */
.kbd {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    font-size: 0.75em;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm, 0.25rem);
    box-shadow: 0 1px 0 var(--border-primary);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============= MARK / HIGHLIGHT ============= */
.mark, mark {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--text-primary);
    padding: 0.05rem 0.2rem;
    border-radius: var(--radius-sm, 0.25rem);
}

/* ============= SCROLLBAR STYLING ============= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ============= BLACK GLASS ============= */
[data-theme="black-glass"] .display-1,
[data-theme="black-glass"] .display-2 {
    text-shadow: 0 0 30px rgba(var(--accent-rgb), 0.25), 0 0 60px rgba(var(--accent-rgb), 0.1);
}
[data-theme="black-glass"] .h1 { text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.15); }
[data-theme="black-glass"] .code-block {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(var(--accent-rgb), 0.1);
}
[data-theme="black-glass"] .blockquote {
    background: rgba(var(--accent-rgb), 0.06);
    border-left-color: var(--accent);
}
[data-theme="black-glass"] .kbd {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ============= WHITE GLASS ============= */
[data-theme="white-glass"] .code, [data-theme="white-glass"] code:not(pre code) {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--accent);
}
[data-theme="white-glass"] .code-block {
    background: #fafafa;
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="white-glass"] .blockquote {
    background: rgba(var(--accent-rgb), 0.04);
}
[data-theme="white-glass"] ::selection { background: rgba(var(--accent-rgb), 0.2); }

/* ============= RETRO 95 ============= */
[data-theme="retro"] .display-1, [data-theme="retro"] .display-2,
[data-theme="retro"] .display-3, [data-theme="retro"] .display-4 {
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    letter-spacing: 0;
    text-shadow: 2px 2px 0 #808080;
}
[data-theme="retro"] .h1, [data-theme="retro"] .h2, [data-theme="retro"] .h3,
[data-theme="retro"] .h4, [data-theme="retro"] .h5, [data-theme="retro"] .h6 {
    font-family: "MS Sans Serif", Tahoma, sans-serif;
}
[data-theme="retro"] .code, [data-theme="retro"] code:not(pre code) {
    font-family: "Courier New", monospace;
    background: #fff;
    border: 1px solid #808080;
    border-radius: 0;
    color: #000;
}
[data-theme="retro"] .code-block {
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    font-family: "Courier New", monospace;
}
[data-theme="retro"] .blockquote {
    background: #d4d0c8;
    border-left: 3px solid #000080;
    border-radius: 0;
}
[data-theme="retro"] .kbd {
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    background: #d4d0c8;
    border: 1px solid #808080;
    border-radius: 0;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff;
}
[data-theme="retro"] .mark, [data-theme="retro"] mark {
    background: #000080;
    color: #fff;
    border-radius: 0;
}
[data-theme="retro"] ::selection { background: #000080; color: #fff; }
[data-theme="retro"] ::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 0; }
[data-theme="retro"] ::-webkit-scrollbar-track { background: #d4d0c8; }

/* ============= HOMEBREW ============= */
[data-theme="homebrew"] .display-1, [data-theme="homebrew"] .display-2,
[data-theme="homebrew"] .display-3, [data-theme="homebrew"] .display-4 {
    font-family: "Courier New", monospace;
    color: #00ff00;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.4), 0 0 40px rgba(0, 255, 0, 0.15);
    text-transform: uppercase;
}
[data-theme="homebrew"] .h1, [data-theme="homebrew"] .h2, [data-theme="homebrew"] .h3,
[data-theme="homebrew"] .h4, [data-theme="homebrew"] .h5, [data-theme="homebrew"] .h6 {
    font-family: "Courier New", monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #00ff00;
}
[data-theme="homebrew"] .h1 { text-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
[data-theme="homebrew"] .text-body, [data-theme="homebrew"] .text-lead {
    font-family: "Courier New", monospace;
    color: #00cc00;
}
[data-theme="homebrew"] .link { color: #00ff00; text-decoration: underline; }
[data-theme="homebrew"] .link:hover { color: #33ff33; }
[data-theme="homebrew"] .code, [data-theme="homebrew"] code:not(pre code) {
    background: rgba(0, 255, 0, 0.06);
    border-color: rgba(0, 255, 0, 0.15);
    color: #00ff00;
    border-radius: 0;
}
[data-theme="homebrew"] .code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 0, 0.15);
    border-radius: 0;
    color: #00ff00;
}
[data-theme="homebrew"] .blockquote {
    background: rgba(0, 255, 0, 0.04);
    border-left: 2px solid #00ff00;
    color: #00cc00;
    border-radius: 0;
}
[data-theme="homebrew"] .kbd {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 0;
    color: #00ff00;
    box-shadow: 0 1px 0 rgba(0, 255, 0, 0.1);
}
[data-theme="homebrew"] .mark, [data-theme="homebrew"] mark {
    background: rgba(0, 255, 0, 0.15);
    color: #00ff00;
    border-radius: 0;
}
[data-theme="homebrew"] ::selection { background: rgba(0, 255, 0, 0.3); color: #00ff00; }
[data-theme="homebrew"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 0;
}
[data-theme="homebrew"] ::-webkit-scrollbar-track { background: #0d1117; }
