:root {
    --page-bg: #f5f7fa;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #18212f;
    --text-soft: #536174;
    --text-muted: #7b8797;
    --line: #e5eaf0;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #e7f5f3;
    --header: #102a43;
    --shadow-sm: 0 4px 16px rgba(23, 42, 58, 0.06);
    --shadow-md: 0 16px 45px rgba(23, 42, 58, 0.1);
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --content-width: 900px;
    --reading-width: 780px;
    --nav-width: 1180px;
}

html {
    scroll-behavior: smooth;
    background: var(--page-bg);
}

body {
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(15, 118, 110, 0.18);
    color: var(--text);
}

a {
    color: var(--accent);
    text-underline-offset: 0.2em;
    transition: color 160ms ease, background-color 160ms ease, opacity 160ms ease;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.28);
    outline-offset: 3px;
}

img {
    max-width: 100%;
}

/* Header and desktop navigation */
header {
    position: relative;
    min-height: 360px;
    overflow: hidden;
    background-color: var(--header);
    background-image:
        linear-gradient(115deg, rgba(10, 30, 47, 0.84), rgba(12, 45, 62, 0.48)),
        url("../img/Background3.png");
    background-position: center 48%;
    background-repeat: no-repeat;
    background-size: cover;
}

header::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.22);
    content: "";
}

.desktop-nav {
    display: flex;
    width: min(var(--nav-width), calc(100% - 48px));
    min-height: 76px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.cleanfix::before,
.cleanfix::after {
    display: none;
}

.desktop-nav .logo,
.desktop-nav .nav_items,
.desktop-nav .c2,
.desktop-nav .c10 {
    position: static;
    float: none;
    width: auto;
}

.desktop-nav .logo {
    padding: 0;
}

#index_html {
    display: flex;
    align-items: center;
}

.logo_image {
    display: block;
    width: 48px;
    height: 48px;
    max-width: none;
    object-fit: contain;
}

.nav_items ul {
    display: flex;
    float: none;
    gap: 4px;
    align-items: center;
}

.nav_items ul li {
    display: block;
}

.nav_items ul li a {
    display: block;
    padding: 10px 13px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav_items ul li a:hover,
.nav_items ul li a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.inner_header {
    display: flex;
    width: min(900px, calc(100% - 40px));
    min-height: 240px;
    margin: 0 auto;
    padding: 54px 0 64px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    font-family: inherit;
}

.inner_header h1,
.blog-article-page .inner_header h1 {
    max-width: 880px;
    margin: 0;
    font-family: inherit;
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    font-weight: 750;
    line-height: 1.16;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.sub_header {
    padding: 18px 0 0;
    color: rgba(255, 255, 255, 0.76);
    font-family: inherit;
    font-size: 16px;
    letter-spacing: 0.08em;
}

/* Search */
.search_mobile {
    display: none;
}

.new_comment {
    display: block;
    position: relative;
    z-index: 2;
    float: none;
    width: min(680px, calc(100% - 40px));
    margin: -31px auto 42px;
    padding: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: var(--shadow-md);
    font-family: inherit;
    line-height: normal;
    backdrop-filter: blur(12px);
}

.new_comment br {
    display: none;
}

.new_comment .search_desktop form table {
    width: 100%;
    height: auto;
}

.new_comment .search_desktop td:last-child {
    text-align: right;
}

.new_comment input[type="text"],
.search_mobile input[type="text"] {
    width: 100% !important;
    height: 44px !important;
    padding: 0 18px;
    border: 0 !important;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    outline: none;
}

.new_comment input[type="submit"],
.search_mobile input[type="submit"] {
    height: 44px !important;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: none;
    color: #fff;
    font-weight: 700;
    line-height: 44px;
}

.new_comment input[type="submit"] {
    display: block;
    margin-left: auto;
}

.new_comment input[type="submit"]:hover,
.search_mobile input[type="submit"]:hover {
    background: var(--accent-strong);
}

/* Main layout and list cards */
.content {
    min-height: 32vh;
}

.container {
    width: min(var(--content-width), calc(100% - 40px));
    margin: 0 auto;
}

.blog-list-page .content > .container {
    width: min(940px, calc(100% - 40px));
    padding-bottom: 34px;
}

.art_item {
    margin: 0 0 22px;
    padding: 30px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-soft);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.art_item:hover {
    border-color: #d7e1e8;
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.art_item h2 {
    margin: 0 0 12px;
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.art_item h2 a {
    color: var(--text);
    font-weight: 750;
}

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

.art_item .summary {
    margin: 0 0 20px;
    color: var(--text-soft);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.8;
    text-align: left;
}

.art_item .info,
.art_item .info a {
    color: var(--text-muted);
    font-size: 13px;
}

.art_item .index_photo {
    display: flex;
    margin: 22px 0 18px;
    padding: 12px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.art_item .index_photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 380px;
    margin: 0 auto;
    object-fit: contain;
}

/* Pagination */
.pagination,
ul.pagination {
    display: flex;
    margin: 8px 0 40px;
    padding: 0;
    gap: 7px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
}

.pagination > li {
    display: block;
}

.pagination > li > a,
.pagination > li > span,
.pagination li a {
    display: inline-flex;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-soft);
    font-weight: 650;
}

.pagination > .active > a,
.pagination li.active a,
.pagination li a.active,
.pagination li a:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.pagination > li.pagination-ellipsis > span {
    min-width: 24px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: var(--text-muted);
}

.blog-list-page .content > .container {
    padding-bottom: 4px;
}

.blog-list-page div.pagination {
    margin: 8px 0 0;
}

.blog-list-page ul.pagination {
    margin: 0 0 14px;
}

.blog-list-page > br {
    display: none;
}

.blog-list-page footer {
    margin-top: 14px;
}

/* Article reading surface */
.blog-article-page .content > .container {
    width: min(var(--reading-width), calc(100% - 40px));
    margin-top: 44px;
    padding: 38px 44px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.article.info {
    margin-bottom: 28px;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.02em;
}

.article.info a {
    color: var(--accent);
    font-weight: 650;
}

.blog-article-page article {
    border: 0;
    color: #2d3748;
    font-size: 17px;
    line-height: 1.9;
    text-align: left;
}

.blog-article-page article p {
    margin: 0 0 1.45em;
}

.blog-article-page article h2,
.blog-article-page article h3,
.blog-article-page article h4 {
    margin: 2em 0 0.75em;
    color: var(--text);
    font-family: inherit;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.blog-article-page article h2 {
    font-size: 1.65em;
}

.blog-article-page article h3 {
    font-size: 1.35em;
}

.blog-article-page article a {
    text-decoration: underline;
    text-decoration-color: rgba(15, 118, 110, 0.35);
    text-decoration-thickness: 1px;
}

.blog-article-page article img {
    height: auto;
    border-radius: var(--radius-sm);
}

.blog-article-page article blockquote {
    margin: 1.8em 0;
    padding: 18px 22px;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--accent-soft);
    color: #315b57;
}

.blog-article-page article pre,
.blog-article-page article .code {
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.65;
    text-align: left;
}

.blog-article-page article code:not([class]) {
    padding: 0.15em 0.4em;
    border-radius: 5px;
    background: #eef2f6;
    color: #be3659;
    font-size: 0.88em;
}

.blog-article-page article table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.blog-article-page article th,
.blog-article-page article td {
    padding: 10px 14px;
    border: 1px solid var(--line);
}

/* Previous/next and comments */
.previous_next {
    display: grid;
    width: min(var(--reading-width), calc(100% - 40px));
    margin: 24px auto 0;
    padding: 22px 26px;
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    font-size: 14px;
}

.previous_next br {
    display: none;
}

.previous_next .next {
    text-align: right;
}

.previous_next .previous a,
.previous_next .next a {
    color: var(--text);
    font-weight: 700;
}

.comment {
    width: min(var(--reading-width), calc(100% - 40px));
    margin: 20px auto 0;
}

#comments.comment,
#comment_list.comment {
    padding: 26px 28px;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-md);
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm);
}

.comment-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.comment-field {
    display: grid;
    gap: 7px;
}

.comment-field > span {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.comment-field > span b {
    margin-right: 3px;
    color: #dc526d;
}

.comment-field--full {
    grid-column: 1 / -1;
}

.commentbox {
    width: 100% !important;
    min-height: 44px;
    padding: 10px 13px !important;
    border: 1px solid #d7dee7 !important;
    border-radius: 9px !important;
    background: var(--surface-muted) !important;
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.commentbox:focus {
    border-color: var(--accent) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
    outline: 0;
}

#comment_text {
    min-height: 150px;
}

.comment-actions {
    margin-top: 18px;
    text-align: right;
}

#submit.button {
    height: 44px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: none;
    color: #fff;
    font-size: 14px;
    font-weight: 750;
    line-height: 44px;
}

#submit.button:hover {
    background: var(--accent-strong);
}

.comment_total {
    margin: 0;
    padding: 18px 0;
    border-color: var(--line);
}

.comment_name {
    color: var(--text);
    font-size: 15px;
    font-weight: 750;
}

.comment_text,
.comment_replyInfo {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.75;
}

.comment_time {
    margin: 6px 0 0;
    color: var(--text-muted) !important;
    font-size: 12px;
}

/* About, copyright, sitemap, errors */
.blog-about-page .content > .container,
.blog-error-page .content > .container {
    width: min(var(--reading-width), calc(100% - 40px));
    margin: 44px auto;
    padding: 36px 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.about.info {
    padding: 0;
    color: var(--text-soft);
    font-family: inherit;
    line-height: 1.85;
}

.blog-sitemap-page .container_sitemap {
    width: min(1180px, calc(100% - 40px));
    margin: 42px auto;
}

.blog-sitemap-page .container_sitemap .row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.blog-sitemap-page .container_sitemap .col-md-1 {
    display: none;
}

.blog-sitemap-page .container_sitemap .col-md-2 {
    float: none;
    width: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.blog-sitemap-page .container_sitemap li {
    min-height: 0 !important;
    margin-bottom: 14px;
}

.blog-sitemap-page .container_sitemap li:first-child a {
    color: var(--text) !important;
    font-size: 18px !important;
}

.blog-sitemap-page .container_sitemap a {
    display: block;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.45;
}

/* Footer and utilities */
footer {
    margin-top: 54px;
    padding: 34px 20px 26px;
    background: #111c2d;
    color: rgba(255, 255, 255, 0.68);
}

.footer_item {
    width: min(var(--nav-width), 100%);
    margin: 0 auto;
    font-family: inherit;
    font-size: 13px;
}

.footer_item > br {
    display: none;
}

.footer_item ul {
    display: flex;
    margin-top: 10px;
    gap: 12px 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.footer_item ul li {
    padding: 0;
}

.footer_item a,
.footer_item ul li a {
    color: rgba(255, 255, 255, 0.84);
}

.back2top {
    right: 22px;
    bottom: 22px;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: rgba(17, 28, 45, 0.9);
    box-shadow: 0 10px 28px rgba(17, 28, 45, 0.24);
    transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms;
    backdrop-filter: blur(8px);
}

.back2top.is-visible {
    transition-delay: 0s;
}

.back2top:hover {
    transform: translateY(-3px);
}

.back2top a,
.back2top a img {
    width: 100%;
    height: 100%;
}

.back2top a img {
    object-fit: cover;
}

/* Mobile navigation */
.cd-bouncy-nav-modal {
    z-index: 20;
    background: rgba(11, 25, 39, 0.94);
    backdrop-filter: blur(16px);
}

.cd-bouncy-nav-trigger {
    display: inline-flex;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.cd-bouncy-nav li:nth-of-type(4) a::before {
    background-image: url("../svg/w_blog.svg");
}

.cd-bouncy-nav li:nth-of-type(5) a::before {
    background-image: url("../svg/w_win.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60%;
}

.cd-bouncy-nav li:nth-of-type(6) a::before {
    background-image: url("../svg/w_about.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

@media screen and (max-width: 980px) {
    .desktop-nav {
        width: min(var(--nav-width), calc(100% - 28px));
    }

    .nav_items ul li a {
        padding: 9px 8px;
        font-size: 12px;
    }

    .blog-sitemap-page .container_sitemap .row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 768px) {
    header {
        min-height: 290px;
        background-image:
            linear-gradient(115deg, rgba(10, 30, 47, 0.86), rgba(12, 45, 62, 0.62)),
            url("../img/Background3.png");
    }

    .desktop-nav {
        display: none;
    }

    .carlzhangblog-container {
        display: block;
        padding: 10px 12px 0;
    }

    .cd-section {
        margin: 0;
    }

    .inner_header {
        min-height: 226px;
        padding: 34px 0 48px;
    }

    .inner_header h1,
    .blog-article-page .inner_header h1 {
        font-size: clamp(1.6rem, 7.4vw, 2.2rem);
        line-height: 1.22;
    }

    .sub_header {
        font-size: 14px;
        letter-spacing: 0.03em;
    }

    .new_comment {
        display: none;
    }

    .search_mobile {
        display: block;
        position: relative;
        z-index: 2;
        width: calc(100% - 28px);
        margin: -18px auto 30px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.97) !important;
        box-shadow: var(--shadow-md);
    }

    .search_mobile table {
        width: 100% !important;
    }

    .container,
    .blog-list-page .content > .container,
    .blog-article-page .content > .container,
    .blog-about-page .content > .container,
    .blog-error-page .content > .container,
    .previous_next,
    .comment {
        width: calc(100% - 28px);
    }

    .art_item {
        padding: 23px 20px;
        border-radius: 15px;
    }

    .art_item:hover {
        transform: none;
    }

    .art_item .index_photo img {
        max-height: 280px;
    }

    .blog-list-page .pagination,
    .blog-list-page ul.pagination {
        gap: 5px;
    }

    .blog-list-page .pagination > li > a,
    .blog-list-page .pagination > li > span {
        min-width: 36px;
        height: 38px;
        padding: 0 9px;
    }

    .blog-article-page .content > .container {
        margin-top: 30px;
        padding: 28px 20px 34px;
        border-radius: 18px;
    }

    .blog-article-page article {
        font-size: 16px;
        line-height: 1.85;
        text-align: left;
    }

    .previous_next {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .previous_next .next {
        text-align: left;
    }

    #comments.comment,
    #comment_list.comment {
        padding: 22px 18px;
    }

    .comment-fields {
        grid-template-columns: 1fr;
    }

    .comment-field--full {
        grid-column: 1;
    }

    .blog-about-page .content > .container,
    .blog-error-page .content > .container {
        margin: 30px auto;
        padding: 28px 22px;
    }

    .about.info .intro_myself,
    .about.info .wechat {
        margin-left: 0;
        text-indent: 0;
    }

    .blog-sitemap-page .container_sitemap {
        width: calc(100% - 28px);
        margin: 30px auto;
    }

    .blog-sitemap-page .container_sitemap .row {
        grid-template-columns: 1fr;
    }

    footer {
        margin-top: 40px;
        padding: 30px 18px 24px;
    }

    .footer_item ul {
        display: flex;
        gap: 8px;
        flex-direction: column;
    }

    .footer_item ul li {
        display: block;
        width: 100%;
        padding: 0;
    }

    .footer_item .divide {
        display: none;
    }

    .back2top {
        right: 14px;
        bottom: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
