@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Golos Text', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1.0625rem;
    line-height: 1.8;
    transition: background-color 0.2s, color 0.2s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container--narrow {
    max-width: 720px;
}

/* ── Header ── */

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

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

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

.header__nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header__link {
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
}

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

.header__link--active {
    color: var(--accent);
    font-weight: 600;
}

.theme-toggle {
    background: none;
    border: none;
    border-radius: 8px;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

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

/* ── Hero ── */

.hero {
    padding: 5rem 0 3rem;
    text-align: center;
}

.hero__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero__description {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── Page Header ── */

.page-header {
    padding: 3rem 0 1.5rem;
}

.page-header__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-header__description {
    font-family: 'Golos Text', sans-serif;
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.6;
}

/* ── Sections ── */

.section {
    padding: 4rem 0;
}

.homepage .section:first-of-type {
    padding-top: 2rem;
}

.section__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.section__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.section__link {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
}

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

/* ── Cards Grid ── */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}

/* ── Card ── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 2px var(--shadow);
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px var(--shadow-hover);
    transform: translateY(-1px);
}

.card__body {
    padding: 1.5rem;
}

.card__date {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.card__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.card__title a {
    color: var(--text-primary);
}

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

.card__excerpt {
    font-family: 'Golos Text', sans-serif;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__github {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    margin-top: 0.5rem;
}

/* ── Tags ── */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 5px;
    background: var(--tag-bg);
    color: var(--tag-text);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.tag--filter {
    cursor: pointer;
    background: var(--tag-filter-bg);
    color: var(--tag-filter-text);
    transition: background-color 0.15s, color 0.15s;
}

.tag--filter:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.tag--active {
    background: var(--accent);
    color: #fff;
}

.tag--active:hover {
    background: var(--accent-hover);
    color: #fff;
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

/* ── Article / Solution Detail ── */

.article-detail {
    padding: 2rem 0 4rem;
}

.article-detail h1 {
    font-family: 'Golos Text', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.article-detail__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.article-detail__image {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
}

.article-detail__body {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-detail__body h2 {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 3rem 0 1rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.article-detail__body h3 {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--text-primary);
}

.article-detail__body h4 {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-primary);
}

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

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

.article-detail__body li {
    margin-bottom: 0.375rem;
}

.article-detail__body img {
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid var(--border-light);
}

.article-detail__body a {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.article-detail__body strong {
    font-weight: 600;
    color: var(--text-primary);
}

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

.article-detail__body blockquote {
    border-left: 3px solid var(--blockquote-border);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--blockquote-bg);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

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

.article-detail__body a {
    word-break: break-word;
    overflow-wrap: break-word;
}

.article-detail__body .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
}

.article-detail__body .table-wrapper table {
    margin: 0;
}

.article-detail__body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
}

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

.article-detail__body th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.article-detail__body tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

/* ── Code Blocks ── */

.article-detail__body pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.75rem 0;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--code-text);
}

.article-detail__body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
}

.article-detail__body pre code {
    font-size: 0.875rem;
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    color: inherit;
}

.article-detail__body :not(pre) > code {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

/* Syntax highlighting */
.tok.kw { color: var(--tok-keyword); font-weight: 500; }
.tok.st { color: var(--tok-string); }
.tok.cm { color: var(--tok-comment); font-style: italic; }
.tok.nu { color: var(--tok-number); }
.tok.fn { color: var(--tok-function); }
.tok.op { color: var(--text-muted); }

/* ── Breadcrumbs ── */

.breadcrumbs {
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.breadcrumbs li::after {
    content: '/';
    margin-left: 0.375rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumbs li:last-child::after {
    display: none;
}

.breadcrumbs a {
    color: var(--text-muted);
}

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

.breadcrumbs [aria-current="page"] {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── GitHub Link Button ── */

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    margin: 1.5rem 0;
    transition: background-color 0.15s, transform 0.15s;
}

.github-link:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Related Articles ── */

.related {
    padding: 3rem 0 4rem;
    border-top: 1px solid var(--border-light);
    margin-top: 3rem;
}

.related__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.card__badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.25rem;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-secondary, #666);
}

/* ── Footer ── */

.footer {
    border-top: 1px solid var(--border-light);
    padding: 2.5rem 0 2rem;
    margin-top: 2rem;
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer__links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.footer__links a {
    color: var(--text-muted);
    font-weight: 450;
    transition: color 0.15s;
}

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

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

/* ── 404 ── */

.not-found {
    text-align: center;
    padding: 6rem 0;
}

.not-found__code {
    font-family: 'Golos Text', sans-serif;
    font-size: 7rem;
    font-weight: 700;
    color: var(--border);
    line-height: 1;
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
}

.not-found__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.not-found__text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.0625rem;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero__title {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    html {
        font-size: 15px;
    }

    .hero {
        padding: 3.5rem 0 2rem;
    }

    .hero__title {
        font-size: 1.75rem;
    }

    .hero__description {
        font-size: 1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .header__nav {
        gap: 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    .page-header__title {
        font-size: 1.5rem;
    }

    .section {
        padding: 2.5rem 0;
    }

    .article-detail h1 {
        font-size: 1.65rem;
    }

    .article-detail__body {
        font-size: 1rem;
    }

    .footer__inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
