:root {
    color-scheme: light;
    --blog-page: #fbfcfe;
    --blog-text: #212121;
    --blog-link: #0e5cf7;
    --blog-border: #e4e8ee;
    --blog-muted: #52606d;
    --blog-subtle: #6d7885;
    --blog-card: #fff;
    --blog-chip: #eef1f5;
    --blog-chip-text: #52606d;
    --blog-hover: rgba(14, 92, 247, 0.12);
    --blog-shadow: 0 8px 24px rgba(33, 33, 33, 0.04);
    --blog-quote: #f4f6f9;
    --blog-focus: #0e5cf7;
    --blog-warning-bg: #fff8e5;
    --blog-warning-border: #e2b33d;
    --blog-warning-text: #674a00;
    --blog-warning-icon: #f3bd35;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --blog-page: #171a1e;
    --blog-text: #edf1f5;
    --blog-link: #69a7ff;
    --blog-border: #323a44;
    --blog-muted: #aab4c0;
    --blog-subtle: #aab4c0;
    --blog-card: #20252b;
    --blog-chip: #323a44;
    --blog-chip-text: #dce3eb;
    --blog-hover: rgba(105, 167, 255, 0.18);
    --blog-shadow: none;
    --blog-quote: #20252b;
    --blog-focus: #90cbff;
    --blog-warning-bg: #2b271c;
    --blog-warning-border: #806a34;
    --blog-warning-text: #f6dfa1;
    --blog-warning-icon: #f2c45c;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        color-scheme: dark;
        --blog-page: #171a1e;
        --blog-text: #edf1f5;
        --blog-link: #69a7ff;
        --blog-border: #323a44;
        --blog-muted: #aab4c0;
        --blog-subtle: #aab4c0;
        --blog-card: #20252b;
        --blog-chip: #323a44;
        --blog-chip-text: #dce3eb;
        --blog-hover: rgba(105, 167, 255, 0.18);
        --blog-shadow: none;
        --blog-quote: #20252b;
        --blog-focus: #90cbff;
        --blog-warning-bg: #2b271c;
        --blog-warning-border: #806a34;
        --blog-warning-text: #f6dfa1;
        --blog-warning-icon: #f2c45c;
    }
}

.blog-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--blog-page);
    color: var(--blog-text);
}

.blog-page::after {
    display: none;
}

.blog-page footer {
    position: static;
    margin-top: auto;
}

.blog-page nav {
    background: var(--blog-page);
    border-bottom: 1px solid transparent;
    padding-inline: 32px;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.blog-page nav.is-scrolled {
    border-bottom-color: var(--blog-border);
}

.blog-page nav img {
    margin-left: 0;
}

.blog-page a {
    color: var(--blog-link);
}

.blog-page a:focus-visible,
.blog-page button:focus-visible {
    outline: 3px solid var(--blog-focus);
    outline-offset: 3px;
}

.skip-link {
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: 8px;
    color: var(--blog-text);
    font-weight: 700;
    left: 16px;
    padding: 10px 14px;
    position: fixed;
    top: 12px;
    transform: translateY(-160%);
    transition: transform 160ms ease;
    z-index: 200;
}

.skip-link:focus {
    transform: translateY(0);
}

.blog-page .menu li a {
    color: var(--blog-muted);
    display: block;
    padding-block: 10px;
}

.blog-page .menu .active a,
.blog-page .menu li:hover a {
    color: var(--blog-text);
}

.blog-main {
    width: calc(100% - 64px);
    max-width: 720px;
    margin-top: 72px;
    margin-bottom: 72px;
}

.blog-main:focus {
    outline: none;
}

.blog-main[dir="rtl"],
.blog-main [lang="fa"],
.blog-main [dir="rtl"] {
    font-family: "Vazirmatn", sans-serif;
}

.blog-main [lang="en"] {
    direction: ltr;
    font-family: "Poppins", sans-serif;
    text-align: left;
}

.blog-header,
.post-header {
    border-bottom: 1px solid var(--blog-border);
    padding-bottom: 32px;
    margin-bottom: 32px;
}

.blog-eyebrow,
.post-date {
    color: var(--blog-subtle);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.post-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.post-date {
    direction: ltr;
    font-family: "Poppins", sans-serif;
    unicode-bidi: isolate;
}

.blog-header[lang="fa"] .blog-eyebrow {
    letter-spacing: 0;
    text-transform: none;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
}

.post-tags li {
    background: var(--blog-chip);
    border-radius: 999px;
    color: var(--blog-chip-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
}

.post-tags a,
.blog-page .post-tags a {
    color: inherit;
    display: block;
    padding: 6px 8px;
    text-decoration: none;
}

.post-tags a:hover,
.post-tags a:focus-visible {
    background: var(--blog-hover);
}

.blog-header h1,
.post-header h1 {
    font-size: clamp(32px, 6vw, 48px);
    line-height: 1.15;
    margin: 8px 0 16px;
}

.blog-header > p:last-child,
.post-description {
    color: var(--blog-muted);
    font-size: 16px;
    line-height: 1.7;
    max-width: 580px;
}

.post-list {
    display: grid;
    gap: 16px;
}

.post-card {
    border: 1px solid var(--blog-border);
    border-radius: 16px;
    background: var(--blog-card);
    padding: 28px;
    box-shadow: var(--blog-shadow);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.post-card:hover,
.post-card:focus-within {
    border-color: color-mix(in srgb, var(--blog-link) 38%, var(--blog-border));
    transform: translateY(-1px);
}

.post-card h2 {
    font-size: 21px;
    line-height: 1.5;
    margin: 8px 0;
}

.post-card > p:not(.post-date) {
    color: var(--blog-muted);
    line-height: 1.65;
    margin-bottom: 16px;
}

.post-link {
    font-weight: 700;
}

.post {
    font-size: 16px;
    line-height: 1.9;
}

.post[dir="rtl"] .post-header h1 {
    line-height: 1.35;
}

.post-content h2,
.post-content h3 {
    font-size: 25px;
    line-height: 1.5;
    margin: 44px 0 14px;
}

.post-content p,
.post-content ul,
.post-content ol {
    margin-bottom: 22px;
}

.post-content ul,
.post-content ol {
    padding-inline-start: 1.5rem;
}

.post-content ol {
    list-style-type: persian;
}

.post-content li {
    padding-inline-start: 0.25rem;
}

.post-content li + li {
    margin-top: 8px;
}

.post-content li > :last-child {
    margin-bottom: 0;
}

.post-content a {
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
    unicode-bidi: isolate;
}

.post-content a:hover {
    text-decoration-thickness: 0.13em;
}

.post-content blockquote {
    background: var(--blog-quote);
    border-inline-start: 3px solid var(--blog-link);
    border-radius: 10px;
    color: var(--blog-muted);
    margin: 30px 0;
    padding: 18px 20px;
}

.post-content blockquote > :last-child {
    margin-bottom: 0;
}

.post-content hr {
    border: 0;
    border-top: 1px solid var(--blog-border);
    margin: 42px 0;
}

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

.post-content pre {
    background: #212121;
    border-radius: 10px;
    color: #f4f6fa;
    margin: 24px 0;
    overflow-x: auto;
    padding: 20px;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content img {
    border-radius: 12px;
    display: block;
    height: auto;
    margin: 28px 0;
    max-width: 100%;
}

.post-content > p:first-child {
    margin-bottom: 0;
}

.post-content > p:first-child img {
    aspect-ratio: 16 / 9;
    margin: 0;
    object-fit: cover;
    width: 100%;
}

.post-content > p:nth-child(2)[lang="en"] {
    color: var(--blog-subtle);
    font-size: 12px;
    line-height: 1.6;
    margin: 10px 0 34px;
}

.post-notice {
    align-items: flex-start;
    background: var(--blog-warning-bg);
    border: 1px solid var(--blog-warning-border);
    border-inline-start-width: 4px;
    border-radius: 12px;
    color: var(--blog-warning-text);
    display: flex;
    gap: 14px;
    line-height: 1.75;
    margin: 0 0 34px;
    padding: 16px 18px;
}

.post-notice p {
    margin: 0;
}

.post-notice-icon {
    align-items: center;
    background: var(--blog-warning-icon);
    border-radius: 50%;
    color: #342500;
    display: inline-flex;
    flex: 0 0 auto;
    font-family: "Poppins", sans-serif;
    font-size: 13px;
    font-weight: 800;
    height: 24px;
    justify-content: center;
    margin-top: 2px;
    width: 24px;
}

.post-content > :last-child {
    margin-bottom: 0;
}

@media only screen and (max-width: 600px) {
    .blog-page nav {
        padding-inline: 16px;
    }

    .blog-page .menu {
        flex-wrap: nowrap;
        gap: 12px;
    }

    .blog-page .menu li {
        margin-left: 0;
    }

    .blog-page .menu li a {
        font-size: 12px;
    }

    .blog-page .theme-picker {
        margin-left: 8px;
    }

    .blog-main {
        margin-top: 48px;
        margin-bottom: 48px;
        width: calc(100% - 40px);
    }

    .post-card {
        padding: 22px;
    }

    .post-content h2,
    .post-content h3 {
        font-size: 22px;
        margin-top: 36px;
    }

    .blog-page .footer-content {
        gap: 16px;
        height: auto;
        min-height: 100px;
        padding-block: 22px;
    }

    .blog-page .social {
        padding-right: 0;
    }
}

@media only screen and (max-width: 360px) {
    .blog-page nav {
        padding-inline: 12px;
    }

    .blog-page .menu {
        gap: 8px;
    }

    .blog-page .menu li a {
        font-size: 11px;
    }

    .blog-page .avatar img {
        height: 28px;
        width: 28px;
    }

    .blog-page .theme-picker {
        margin-left: 4px;
    }
}

@media only screen and (min-width: 945px) {
    .blog-page nav {
        padding-inline: 0;
    }
}

.theme-picker {
    align-items: center;
    display: flex;
    margin-left: 12px;
    position: relative;
}

.theme-picker button {
    font: inherit;
}

.theme-picker-trigger {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--blog-text);
    cursor: pointer;
    display: flex;
    height: 36px;
    justify-content: center;
    padding: 0;
    transition: background-color 160ms ease, transform 160ms ease;
    width: 36px;
}

.theme-picker-trigger:hover,
.theme-picker-trigger[aria-expanded="true"] {
    background: var(--blog-chip);
}

.theme-picker-trigger:active {
    transform: scale(0.94);
}

.theme-picker svg {
    display: block;
    height: 18px;
    stroke-width: 1.8;
    width: 18px;
}

.theme-icon-light {
    color: #f3b63f;
}

.theme-icon-dark {
    color: #fff0ad;
}

.theme-icon-auto {
    color: #90cbff;
}

.theme-picker-icon {
    align-items: center;
    display: flex;
    height: 18px;
    justify-content: center;
    width: 18px;
}

.theme-picker-menu {
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    display: grid;
    gap: 2px;
    min-width: 138px;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 10;
}

.theme-picker-menu::after {
    background: var(--blog-card);
    border-right: 1px solid var(--blog-border);
    border-top: 1px solid var(--blog-border);
    content: "";
    height: 10px;
    position: absolute;
    right: 13px;
    top: -6px;
    transform: rotate(-45deg);
    width: 10px;
}

.theme-picker-menu button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--blog-text);
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 9px 10px;
    position: relative;
    text-align: left;
    width: 100%;
}

.theme-picker-menu button:hover,
.theme-picker-menu button:focus-visible {
    background: var(--blog-chip);
}

.theme-picker-menu button[aria-checked="true"]::after {
    background: #69a7ff;
    border-radius: 50%;
    content: "";
    height: 6px;
    margin-left: auto;
    width: 6px;
}

.theme-picker-menu[hidden] {
    display: none;
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.blog-page .social {
    display: flex;
    gap: 4px;
}

.blog-page .social a {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.blog-page .social a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.blog-page .social img {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .blog-page *,
    .blog-page *::before,
    .blog-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
