:root {
    --bg: #f4f4f6;
    --bg-subtle: #eeeef1;
    --border: #d4d4d8;

    --text: #1c1c1e;
    --text-secondary: #52525b;
    --text-muted: #71717a;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;

    /*--cube-primary: #c7d2fe;
    --cube-secondary: #818cf8;*/
    --cube-primary: #ffe0f0;
    --cube-secondary: #ffb6d5;

    --tag-bg: #e4e4e7;

    --code-bg: #ededf0;
    --code-border: #d4d4d8;
    --code-accent: #6366f1;

    --toc-bg: #f9f9fb;

    --header-height: 64px;
    --footer-height: 56px;
    --page-max-width: min(1100px, 100vw);
    --card-max-width: 800px;
    --blog-post-max-width: min(1000px, 100vw);
}

/* Reset & base */

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    font-optical-sizing: auto;
    line-height: 1.6;
}

h1, h2, h3, h4 {
    line-height: 1.35;
    margin: 0.5rem 0;
    scroll-margin-top: 5rem;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: var(--accent);
    transition: color 0.15s;
}

a:hover {
    color: var(--accent-hover);
}

p a,
li a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

ul, ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

ul ul, ul ol, ol ul, ol ol {
    margin-bottom: 0;
}

li::marker {
    color: var(--accent);
}

pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-left: 3px solid var(--code-accent);
    border-radius: 0 6px 6px 0;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0.75rem 0 1.25rem;
    padding: 0.75rem 1rem;
    overflow-x: auto;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    background-color: var(--code-bg);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

pre code {
    background: none;
    padding: 0;
}

img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Layout */

.limit-width {
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
}

/* Header */

header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.nav-title > a {
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header nav {
    display: flex;
    gap: 1.5rem;
}

header nav a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

header nav a:hover {
    color: var(--accent);
}

/* Footer */

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: var(--footer-height);
    border-top: 1px solid var(--border);
    padding: 1rem 0;
}

.footer-icons {
    display: flex;
    gap: 1.25rem;
}

.footer-icons a {
    color: var(--text-muted);
    transition: color 0.15s;
}

.footer-icons a:hover {
    color: var(--accent);
}

/* Blog listing */

.blog-card-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: var(--card-max-width);
    margin-top: 1.5rem;
}

.blog-card {
    display: block;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.blog-card:hover {
    border-color: var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.blog-card-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.blog-card-title h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.05rem;
    transition: color 0.15s;
}

.blog-card:hover .blog-card-title h3 {
    color: var(--accent);
}

.blog-card-title span {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0.25rem 0 0.5rem;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    background-color: var(--tag-bg);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Blog post */

.blog-header {
    text-align: center;
    margin-bottom: 2rem;
}

.blog-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.blog-content {
    max-width: var(--blog-post-max-width);
    line-height: 1.8;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.blog-content img {
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    margin: 1rem auto;
}

.blog-content figure {
    text-align: center;
    width: 90%;
    margin: 1.25rem auto;
}

.blog-content figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-style: italic;
}

/* Table of contents */

.toc {
    background: var(--toc-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    position: fixed;
    top: 6rem;
    left: calc(50vw + var(--page-max-width) / 2 + 1rem);
    max-height: 60vh;
    max-width: 280px;
    overflow-y: auto;
    padding: 0.75rem 1.5rem 0.75rem 1rem;
}

.toc h2 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.toc ul {
    list-style: none;
    padding-left: 0;
}

.toc li a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.8;
}

.toc li a:hover {
    color: var(--accent);
}

.toc-h3 a {
    padding-left: 1rem;
}

/* Front page */

.front-page-content {
    justify-content: center;
}

.front-page-terminal {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.front-page-terminal span:nth-of-type(-n + 3) {
    font-weight: bold;
}

.front-page-terminal span:first-of-type {
    color: #dc2626;
}

.front-page-terminal span:nth-of-type(3) {
    color: var(--accent);
}

/* Responsive */

@media (max-width: 1600px) {
    .toc {
        display: none;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 0.875rem;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.15rem; }

    .front-page-content {
        text-align: center;
    }

    .front-page-terminal {
        font-size: 0.85rem;
    }

    .blog-card-title {
        flex-direction: column;
        gap: 0;
    }

    pre {
        font-size: 0.8rem;
    }
}
