@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 {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

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

.header__logo-img {
    display: none;
    height: 1.75rem;
    width: auto;
}

[data-theme="light"] .header__logo-img--light {
    display: block;
}

[data-theme="dark"] .header__logo-img--dark {
    display: block;
}

.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;
}

.header__search {
    display: flex;
    align-items: center;
}

.header__search-input {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3rem 0.75rem;
    width: 9rem;
    transition: border-color 0.15s, width 0.15s;
}

.header__search-input:focus {
    outline: none;
    border-color: var(--accent);
    width: 11rem;
}

.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 {
    position: relative;
    overflow: hidden;
    padding: 5rem 0 3rem;
    text-align: center;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    width: min(34rem, 80vw);
    height: 22rem;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    filter: blur(60px);
    opacity: var(--hero-haze-opacity, 0.14);
    pointer-events: none;
    animation: haze-drift-a 28s ease-in-out infinite alternate;
}

.hero::before {
    top: -30%;
    left: -12%;
}

.hero::after {
    bottom: -35%;
    right: -12%;
    animation-name: haze-drift-b;
    animation-duration: 36s;
}

@keyframes haze-drift-a {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(12%, 18%) scale(1.2);
    }
}

@keyframes haze-drift-b {
    from {
        transform: translate(0, 0) scale(1.1);
    }

    to {
        transform: translate(-14%, -16%) scale(0.95);
    }
}

@media (prefers-reduced-motion: reduce) {

    .hero::before,
    .hero::after {
        animation: none;
    }
}

.hero__title {
    font-family: monospace;
    font-size: 2.1rem;
    font-weight: 300;
    text-transform: uppercase;
    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;
    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);
    text-decoration: none;
    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-direction: column;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.tag-filter__header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 1rem;
}

.tag-filter__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.tag-filter__search {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-filter__input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tag-filter__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.tag-filter__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

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

.tag-filter__empty {
    flex: 0 0 100%;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

.tag-filter__count {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
}

.tag--more {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
}

.section-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    margin: 2rem 0;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 10px;
}

.section-empty__title {
    font-family: 'Golos Text', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-empty__text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

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

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

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin: 2rem 0 0;
}

.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

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

.pagination__link--current,
.pagination__link--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination__link--current:hover,
.pagination__link--active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.pagination__link--disabled {
    background: var(--bg-primary);
    border-color: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

.pagination__link--disabled:hover {
    background: var(--bg-primary);
    border-color: var(--border-light);
    color: var(--text-muted);
}

.pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

/* ── 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:first-child,
.article-detail__body td:first-child {
    white-space: nowrap;
}

.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;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
}

.footer__featured {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
}

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

.footer__links a:hover,
.footer__featured 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);
    }

    .header__nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .header__link {
        font-size: 0.8125rem;
    }

    .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;
    }

    .header__search-input {
        width: 6.5rem;
    }

    .header__search-input:focus {
        width: 7.5rem;
    }

    .header__inner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .header__nav {
        flex: 1 1 100%;
        justify-content: center;
        gap: 0.625rem 0.875rem;
    }

    .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;
    }

    .tag-filter__header {
        flex-direction: column;
        align-items: stretch;
    }

    .tag-filter__search {
        width: 100%;
    }

    .pagination {
        gap: 0.25rem;
    }
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 32rem;
    margin-top: 1rem;
}

.search-form__input {
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.search-form__input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-form__button {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.search-form__button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.search-form__count {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.card__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
