* {
    box-sizing: border-box;
}

:root {
    --bg: #101214;
    --surface: #171a1e;
    --surface-hover: #1d2126;
    --text: #e8eaed;
    --muted: #9299a3;
    --border: #2a2f36;
    --accent: #7aa2f7;
    --danger: #e06c75;
    --code: #0b0d0f;
    --max: 760px;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.75;
}

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

a:hover {
    text-decoration: underline;
}

.wrap {
    width: min(calc(100% - 32px), var(--max));
    margin-inline: auto;
}

.site-header {
    border-bottom: 1px solid var(--border);
}

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-link {
    color: var(--muted);
    font-size: 0.9rem;
}

.header-link:hover {
    color: var(--text);
}

.intro {
    padding: 76px 0 54px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.intro h1 {
    max-width: 650px;
    margin: 0;
    font-size: clamp(2rem, 7vw, 3.1rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.search-form {
    margin: 0 0 34px;
}

.search-form label {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search-row input {
    min-width: 0;
    flex: 1;
    min-height: 46px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.search-row input:focus {
    border-color: var(--accent);
}

.search-row button {
    min-height: 46px;
}

.search-status {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.84rem;
}

.search-status a {
    color: var(--text);
}

.post-list {
    border-top: 1px solid var(--border);
}

.post-preview {
    padding: 32px 0 36px;
    border-bottom: 1px solid var(--border);
}

.post-preview time,
.article-header time,
.admin-item time {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.post-preview h2 {
    margin: 8px 0 8px;
    font-size: 1.65rem;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.post-preview h2 a {
    color: var(--text);
}

.post-preview p {
    margin: 0 0 14px;
    color: var(--muted);
}

.read-link {
    font-size: 0.92rem;
    font-weight: 600;
}

.empty {
    padding: 48px 0;
    color: var(--muted);
}

.site-footer {
    padding: 50px 0 70px;
    color: var(--muted);
    font-size: 0.82rem;
}

.article-page {
    padding-top: 36px;
}

.back-link {
    display: inline-block;
    margin-bottom: 42px;
    color: var(--muted);
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--text);
}

.article-header {
    padding-bottom: 34px;
    border-bottom: 1px solid var(--border);
}

.article-header h1 {
    margin: 10px 0 14px;
    font-size: clamp(2.1rem, 8vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.article-summary {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.article-content {
    padding: 34px 0 70px;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.article-content h1 {
    font-size: 2rem;
    margin-top: 2.4em;
}

.article-content h2 {
    font-size: 1.55rem;
    margin-top: 2.3em;
}

.article-content h3 {
    font-size: 1.25rem;
    margin-top: 2em;
}

.article-content p {
    margin: 1.1em 0;
}

.article-content ul,
.article-content ol {
    padding-left: 1.4em;
}

.article-content li {
    margin: 0.35em 0;
}

.article-content blockquote {
    margin: 1.5em 0;
    padding: 2px 0 2px 20px;
    border-left: 2px solid var(--accent);
    color: var(--muted);
}

.article-content code {
    padding: 0.15em 0.35em;
    border-radius: 4px;
    background: var(--code);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.article-content pre {
    overflow-x: auto;
    margin: 1.5em 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--code);
}

.article-content pre code {
    padding: 0;
    background: transparent;
    font-size: 0.86rem;
    line-height: 1.6;
}

.table-wrap {
    overflow-x: auto;
    margin: 1.5em 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.article-content th,
.article-content td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.article-content th {
    background: var(--surface);
}

.admin-page,
.editor-page {
    padding-top: 48px;
    padding-bottom: 70px;
}

.admin-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 38px;
}

.admin-heading h1,
.editor-heading h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #0d1117;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.button:hover,
button:hover {
    text-decoration: none;
    filter: brightness(1.08);
}

.button.secondary {
    border-color: var(--border);
    background: transparent;
    color: var(--text);
}

.admin-nav {
    display: flex;
    gap: 18px;
    font-size: 0.9rem;
}

.admin-list {
    border-top: 1px solid var(--border);
}

.admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 0;
    border-bottom: 1px solid var(--border);
}

.admin-item h2 {
    margin: 4px 0 0;
    font-size: 1.05rem;
}

.admin-actions {
    display: flex;
    gap: 14px;
    white-space: nowrap;
    font-size: 0.86rem;
}

.danger-link {
    color: var(--danger);
}

.editor-heading {
    margin-bottom: 32px;
}

.editor-heading .back-link {
    margin-bottom: 18px;
}

.editor-form {
    display: grid;
    gap: 10px;
}

.editor-form label {
    margin-top: 14px;
    font-size: 0.88rem;
    font-weight: 700;
}

.editor-form label span {
    margin-left: 5px;
    color: var(--muted);
    font-weight: 400;
}

.editor-form input,
.editor-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.editor-form input {
    min-height: 48px;
    padding: 10px 13px;
}

.editor-form textarea {
    padding: 12px 13px;
    resize: vertical;
}

.editor-form input:focus,
.editor-form textarea:focus {
    border-color: var(--accent);
}

.summary-input {
    min-height: 100px;
}

.content-input {
    min-height: 440px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.65 !important;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.form-error {
    margin: 0 0 20px;
    padding: 10px 12px;
    border: 1px solid #512b2f;
    border-radius: 6px;
    background: #241518;
    color: #ff9ca3;
}

.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.admin-box {
    width: min(100%, 380px);
}

.admin-box h1 {
    margin: 42px 0 5px;
    font-size: 2rem;
}

.admin-box > p {
    color: var(--muted);
}

.admin-box form {
    display: grid;
    gap: 9px;
    margin: 28px 0;
}

.admin-box label {
    font-size: 0.88rem;
    font-weight: 700;
}

.admin-box input {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    outline: none;
}

.admin-box input:focus {
    border-color: var(--accent);
}

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

    .wrap {
        width: min(calc(100% - 28px), var(--max));
    }

    .header-inner {
        min-height: 58px;
    }

    .intro {
        padding: 52px 0 40px;
    }

    .post-preview {
        padding: 26px 0 30px;
    }

    .search-row {
        flex-direction: column;
    }

    .search-row button {
        width: 100%;
    }

    .post-preview h2 {
        font-size: 1.4rem;
    }

    .article-page {
        padding-top: 28px;
    }

    .article-header h1 {
        font-size: 2.2rem;
    }

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

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

    .admin-actions {
        flex-wrap: wrap;
    }

    .editor-actions {
        justify-content: stretch;
    }

    .editor-actions .button,
    .editor-actions button {
        flex: 1;
    }
}
