/* dani-sola.com — shared styles
   Design tokens, base styles, theme toggle, post lists and article
   typography. Page-specific layout lives inline in each page's
   <style> block. */

:root {
    color-scheme: light;

    --bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --border: #e5e5e5;
    --code-bg: #f8fafc;

    /* Syntax highlighting (baked into article HTML, no runtime JS) */
    --tok-comment: #94a3b8;
    --tok-string: #059669;
    --tok-keyword: #3b82f6;
    --tok-number: #d97706;
    --tok-prompt: #64748b;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0a0a0a;
    --text: #fafafa;
    --text-secondary: #64748b;
    --text-muted: #475569;
    --accent: #60a5fa;
    --border: #262626;
    --code-bg: #12151a;

    --tok-comment: #64748b;
    --tok-string: #34d399;
    --tok-keyword: #60a5fa;
    --tok-number: #fbbf24;
    --tok-prompt: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.3s, color 0.3s;
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--accent);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .sun {
    display: none;
}

.theme-toggle .moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon {
    display: none;
}

/* Post lists (homepage Latest articles / Latest reads sections) */
.post-list {
    list-style: none;
    padding: 0.75rem 0 0;
    margin: 0;
    display: inline-block;
    text-align: left;
}

.post-list li {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 0.35rem 0;
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
}

.post-list .date {
    color: var(--text-muted);
    min-width: 4.5rem;
    text-align: right;
    flex-shrink: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding-top: 0.15rem;
}

.post-list .entry {
    display: block;
}

.post-list .entry a {
    color: inherit;
    text-decoration: none;
}

.post-list .entry a:hover {
    color: var(--accent);
}

.post-list .desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.15rem;
}

/* Article pages */
.article {
    max-width: 48rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.article-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.article .back {
    color: var(--text);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: color 0.15s ease;
}

.article .back .arr {
    color: var(--accent);
}

.article .back:hover {
    color: var(--accent);
}

.article .date {
    color: var(--text-muted);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0;
    margin-left: auto;
}

/* Keep the date clear of the fixed theme toggle in the top-right corner */
@media (max-width: 53rem) {
    .article-head {
        padding-right: 4.25rem;
    }
}

.article h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    text-wrap: balance;
    margin-bottom: 1rem;
}

.article .description {
    color: var(--text-secondary);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2.75rem;
}

.article p,
.article li {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.0625rem;
    line-height: 1.75;
}

.article p {
    margin-bottom: 1.25rem;
}

.article a {
    color: var(--accent);
    text-decoration: none;
}

.article a:hover {
    text-decoration: underline;
}

.article h2 {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 2.75rem 0 1rem;
}

.article h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 2.25rem 0 0.75rem;
}

.article ul,
.article ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.article li {
    margin-bottom: 0.45rem;
}

.article li::marker {
    color: var(--text-muted);
}

.article blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1.25rem;
    margin: 1.75rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article blockquote p {
    margin-bottom: 0.75rem;
}

.article blockquote p:last-child {
    margin-bottom: 0;
}

.article hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
}

.article code {
    font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.article pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0 1.75rem;
}

.article pre code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.65;
}

/* Syntax highlighting tokens */
.tok-cm {
    color: var(--tok-comment);
    font-style: italic;
}

.tok-kw {
    color: var(--tok-keyword);
}

.tok-st {
    color: var(--tok-string);
}

.tok-nm {
    color: var(--tok-number);
}

.tok-pr {
    color: var(--tok-prompt);
    font-weight: 600;
    user-select: none;
}

.tok-out {
    color: var(--text-muted);
}

/* Images */
.article figure {
    margin: 2rem 0 2.25rem;
}

.article figure img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.article figcaption {
    color: var(--text-muted);
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.75rem;
}

/* Tables */
.article .table-wrap {
    overflow-x: auto;
    margin: 1.5rem 0 1.75rem;
}

.article table {
    width: 100%;
    border-collapse: collapse;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
}

.article th,
.article td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.85rem;
    text-align: left;
}

.article th {
    background: var(--code-bg);
    font-weight: 600;
}

.article td {
    color: var(--text-secondary);
}

/* Article footer */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none;
    }
}
