:root {
    --bg: #fefefe;
    --ink: #1c1b19;
    --muted: #6b6860;
    --accent: #3a5a78;
    --rule: #e5e5e5;
    --code-bg: #f2f2f2;
    --hover-bg: #fafafa;
    --accent-active: #282ced;
    --accent-active-light: color-mix(in srgb, var(--accent-active) 20%, white);
    --accent-active-mid: color-mix(in srgb, var(--accent-active) 45%, white);
    --accent-active-soft: color-mix(in srgb, var(--accent-active) 32%, white);
    --max-w: 680px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

header.site nav {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}

@media (max-width: 500px) {
    header.site nav {
        flex-wrap: wrap;
        padding-bottom: 5px;
    }

        header.site nav .nav-links {
            width: 100%;
            justify-content: flex-start;
            margin-top: 2.8rem;
        }

    main {
        padding-top: 1.25rem;
    }
}

    header.site nav .brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: var(--ink);
        text-decoration: none;
        font-weight: 500;
        font-size: 1.15rem;
        line-height: 1;
    }

        header.site nav .brand:hover {
            color: var(--accent-active);
        }

        header.site nav .brand .logo {
            height: 75px;
            padding-right: 10px;
            object-fit: contain;
            flex: none;
        }

    header.site nav a {
        color: var(--ink);
        text-decoration: none;
        font-weight: 500;
    }

    header.site nav .nav-links {
        display: flex;
        align-items: center;
        gap: 1.25rem;
        line-height: 1;
    }

        header.site nav .nav-links a.active {
            color: var(--accent-active);
            font-weight: 600;
            padding-bottom: 1px;
            border-bottom: 3px solid currentColor;
        }

a.back-link {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.85rem;
    margin-top: 2rem;
}

    a.back-link::before {
        content: "← ";
    }

main {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

    .meta .date {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 0.78rem;
        color: var(--muted);
        margin-right: 0.3rem;
    }

.tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 16px;
    padding: 3px 6px;
    border: 1px solid;
    border-radius: 5px;
    white-space: nowrap;
}

    .tag:hover {
        border-color: currentColor;
    }

.tag-blue {
    background: #ddf4ff;
    color: #0969da;
    border-color: #ddf4ff;
}

.tag-green {
    background: #dafbe1;
    color: #1a7f37;
    border-color: #dafbe1;
}

.tag-purple {
    background: #fbefff;
    color: #8250df;
    border-color: #fbefff;
}

.tag-orange {
    background: #fff1e5;
    color: #bc4c00;
    border-color: #fff1e5;
}

.tag-pink {
    background: #ffeef8;
    color: #bf3989;
    border-color: #ffeef8;
}

.tag-yellow {
    background: #fff8c5;
    color: #9a6700;
    border-color: #fff8c5;
}

#article {
    opacity: 0;
    animation: fade-in 0.4s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
    #article {
        animation: none;
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#article h1,
#article h2,
#article h3,
#article h4 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
}

#article h1 {
    font-size: clamp(1.75rem, 4vw + 1rem, 2.5rem);
    line-height: 1.2;
    margin: 0 0 1rem;
}

#article h2 {
    font-size: clamp(1.6rem, 3vw + 1rem, 2.2rem);
    margin: 2.5rem 0 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule);
}

#article h3 {
    font-size: 1.4rem;
    margin: 2rem 0 0.75rem;
}

#article p {
    margin: 0 0 1.1rem;
}

#article strong, #article b {
    font-weight: 600;
}

#article h4 {
    font-size: 1.15rem;
    margin: 1.75rem 0 0.6rem;
}

#article a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

#article ul, #article ol {
    margin: 0 0 1.1rem;
    padding-left: 1.3rem;
}

#article li {
    margin-bottom: 0.4rem;
}

#article blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 1rem;
    border: none;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

#article code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

#article pre {
    background: var(--code-bg);
    padding: 1rem 1.1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

    #article pre code {
        background: none;
        padding: 0;
        font-size: 0.85rem;
        line-height: 1.5;
    }

#article img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

#article table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

#article th, #article td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--rule);
}

#article th {
    font-weight: 600;
}

#article hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}

@media (max-width: 480px) {
    #article h1 {
        font-size: 1.6rem;
    }

    #article h2 {
        font-size: 1.5rem;
    }
}

/* Label filter (index page) */

.filter-bar {
    margin-top: -0.75rem;
    margin-bottom: 2.25rem;
}

    .page-intro + .filter-bar {
        margin-top: 0;
    }

.filter-input-wrap {
    position: relative;
}

.filter-input {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--accent-active-soft);
    border-radius: 0;
    padding: 0.25rem 0.6rem;
    cursor: text;
}

    .filter-input:focus-within {
        border-color: var(--accent-active-mid);
    }

.filter-text {
    flex: 1 1 80px;
    min-width: 80px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    background: transparent;
    border: none;
    outline: none;
    padding: 0.15rem 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    line-height: 1;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0.7;
}

    .filter-chip-remove:hover {
        opacity: 0.85;
    }

.filter-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    position: absolute;
    z-index: 10;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.7rem 0.6rem;
    list-style: none;
    background: #fff;
    border: 1px solid var(--accent-active-mid);
    border-radius: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    max-height: 220px;
    overflow-y: auto;
}

    .filter-suggestions[hidden] {
        display: none;
    }

    .filter-suggestions li {
        cursor: pointer;
    }

        .filter-suggestions li.active {
            border-color: currentColor;
        }

.filter-empty {
    margin: 1.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Article list (index page) */

ul.article-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-item {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--accent-active-light);
    text-decoration: none;
    color: inherit;
}

    .article-item[hidden] {
        display: none;
    }

    .article-item:last-child {
        border-bottom: none;
    }

.article-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

    a.article-title:hover {
        color: var(--accent-active);
        text-decoration: underline;
    }

.article-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

    .article-item-meta .date {
        margin-right: 0;
        font-size: 0.9rem;
    }

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: none;
}

    .project-description + .article-tags {
        margin-top: 0.4rem;
    }

    .article-tags .tag {
        cursor: pointer;
    }

.article-links {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.page-intro {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.claude-description {
    margin: 0 0 1.5rem;
    background: var(--code-bg);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 1rem 1.1rem;
    border-radius: 6px;
    white-space: pre-wrap;
}

.project-description {
    margin: 0.4rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
}

    .article-links a {
        color: var(--accent);
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
    }

.site-copyright {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: var(--muted);
}
