/*
Theme Name: Sndow CMS Default Theme
Description: Sndow CMS 官方默认主题，内容优先、清爽稳定的通用站点样式。
Version: 1.1.2
Author: Sndow Team
*/

:root {
    --sd-primary: #405cf5;
    --sd-primary-dark: #2945d8;
    --sd-primary-rgb: 64, 92, 245;
    --sd-accent: #10b981;
    --sd-bg: #f7f8fb;
    --sd-surface: #ffffff;
    --sd-surface-muted: #f1f4f9;
    --sd-text-main: #172033;
    --sd-text-muted: #667085;
    --sd-border: #dfe5ef;
    --sd-border-strong: #c8d1df;
    --sd-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --sd-shadow-md: 0 8px 18px rgba(16, 24, 40, 0.07);
    --sd-radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--sd-bg);
    color: var(--sd-text-main);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--sd-primary);
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

a:hover {
    color: var(--sd-primary-dark);
}

img {
    max-width: 100%;
}

.container {
    max-width: 1180px;
}

.content-area {
    min-width: 0;
}

/* Header */
.navbar {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid var(--sd-border);
    padding: 0.55rem 0;
    box-shadow: none !important;
}

.navbar-brand {
    color: var(--sd-text-main) !important;
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: 0;
}

.navbar-brand img {
    max-height: 28px;
}

.navbar-brand i {
    color: var(--sd-primary);
}

.navbar-toggler {
    color: var(--sd-text-main);
}

.navbar-nav {
    align-items: center;
}

.nav-link {
    color: var(--sd-text-muted) !important;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.34rem 0.58rem !important;
    border-radius: 6px;
}

.nav-link:hover,
.nav-link.active,
.dropdown-item.active {
    color: var(--sd-primary) !important;
    background: rgba(var(--sd-primary-rgb), 0.08);
}

.dropdown-menu {
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius) !important;
    box-shadow: var(--sd-shadow-md);
    padding: 0.35rem;
}

.dropdown-item {
    color: var(--sd-text-main);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.45rem 0.65rem;
}

.dropdown-item:hover {
    color: var(--sd-primary);
    background: rgba(var(--sd-primary-rgb), 0.08);
}

main.container {
    padding-top: 1.25rem !important;
    padding-bottom: 2rem !important;
}

/* Common blocks */
.sd-card,
.post-card,
.comment-form,
.empty-state,
.archive-header,
.author-bio-card,
.nav-card {
    background: var(--sd-surface) !important;
    border: 1px solid var(--sd-border) !important;
    border-radius: var(--sd-radius) !important;
    box-shadow: var(--sd-shadow-sm) !important;
}

.archive-header {
    padding: 0.9rem 1rem !important;
    margin-bottom: 1rem !important;
    border-left: 3px solid var(--sd-primary) !important;
}

.archive-header h4,
.section-title h3 {
    color: var(--sd-text-main);
    font-size: 1.05rem;
    font-weight: 750;
    margin-bottom: 0.25rem;
}

.section-title {
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-left: 3px solid var(--sd-primary);
    border-radius: var(--sd-radius);
    padding: 0.9rem 1rem;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0.9rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 0.84rem;
}

.breadcrumb-item a {
    color: var(--sd-text-muted);
}

.breadcrumb-item.active {
    color: var(--sd-text-main);
    font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "\F285";
    font-family: "bootstrap-icons";
    color: #98a2b3;
    font-size: 0.62rem;
}

/* List cards */
.post-list-wrapper .row,
.category-wrapper .row,
.search-wrapper .row {
    --bs-gutter-y: 0.8rem;
}

.post-card {
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.post-card:hover {
    border-color: var(--sd-border-strong) !important;
    box-shadow: var(--sd-shadow-md) !important;
    transform: translateY(-1px);
}

.post-card .row {
    align-items: flex-start !important;
    min-height: 170px;
}

.post-card .col-md-4 {
    flex: 0 0 250px;
    width: 250px;
    padding: 1rem 0 1rem 1rem;
}

.post-card .col-md-4 a {
    display: block;
    height: 150px;
    min-height: 150px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--sd-surface-muted);
}

.post-card img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    transition: transform 0.24s ease;
}

.post-card:hover img {
    transform: scale(1.025);
}

.post-card .card-body {
    padding: 1rem 1rem 1rem 1.05rem !important;
}

.post-card .card-title {
    font-size: 1.04rem;
    line-height: 1.45;
    margin-bottom: 0.55rem !important;
}

.post-card .card-title a {
    color: var(--sd-text-main) !important;
}

.post-card .card-title a:hover {
    color: var(--sd-primary) !important;
}

.post-card .card-text {
    color: var(--sd-text-muted) !important;
    font-size: 0.88rem !important;
    line-height: 1.6;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--sd-text-muted);
    font-size: 0.8rem;
}

.post-meta .badge {
    background: rgba(var(--sd-primary-rgb), 0.09) !important;
    color: var(--sd-primary) !important;
    border: 1px solid rgba(var(--sd-primary-rgb), 0.12);
    border-radius: 6px !important;
    padding: 0.24rem 0.45rem !important;
}

.post-info {
    color: var(--sd-text-muted) !important;
}

.btn {
    border-radius: 6px !important;
    font-weight: 700;
}

.btn-primary {
    --bs-btn-bg: var(--sd-primary);
    --bs-btn-border-color: var(--sd-primary);
    --bs-btn-hover-bg: var(--sd-primary-dark);
    --bs-btn-hover-border-color: var(--sd-primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--sd-primary);
    --bs-btn-border-color: rgba(var(--sd-primary-rgb), 0.3);
    --bs-btn-hover-bg: var(--sd-primary);
    --bs-btn-hover-border-color: var(--sd-primary);
}

/* Sidebar widgets */
.sidebar {
    position: sticky;
    top: 74px;
}

.sd-sidebar-widgets {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sd-sidebar-widgets .sd-widget {
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 0.9rem;
    box-shadow: var(--sd-shadow-sm);
}

.sd-widget-title {
    color: var(--sd-text-main);
    font-size: 0.9rem;
    font-weight: 750;
    margin: 0 0 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--sd-border);
}

.sd-widget-title::after {
    display: none;
}

.sd-widget-text {
    color: var(--sd-text-muted);
    font-size: 0.88rem;
}

.sd-widget-posts,
.sd-widget-categories,
.sd-widget-menu,
.sd-widget-archive,
.sd-widget-comments,
.sd-widget-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sd-widget-links-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.15rem;
}

.sd-widget-links-inline span {
    display: inline-flex;
    min-width: 0;
}

.sd-widget-links-inline a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    max-width: 100%;
    padding: 0.32rem 0.62rem;
    border: 1px solid rgba(var(--sd-primary-rgb), 0.16);
    border-radius: 7px;
    background: rgba(var(--sd-primary-rgb), 0.06);
    color: var(--sd-primary);
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.25;
    word-break: break-word;
}

.sd-widget-links-inline a:hover {
    border-color: rgba(var(--sd-primary-rgb), 0.34);
    background: rgba(var(--sd-primary-rgb), 0.11);
    color: var(--sd-primary);
}

.sd-widget-posts li,
.sd-widget-categories li,
.sd-widget-menu li,
.sd-widget-archive li,
.sd-widget-comments li,
.sd-widget-links li {
    margin: 0;
}

.sd-widget-posts li a,
.sd-widget-categories li a,
.sd-widget-menu li a,
.sd-widget-archive li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.42rem 0;
    color: var(--sd-text-main);
    border-bottom: 1px solid rgba(223, 229, 239, 0.8);
    font-size: 0.88rem;
    font-weight: 600;
}

.sd-widget-links li a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 36px;
    padding: 0.5rem 0.62rem;
    margin-bottom: 0.42rem;
    border: 1px solid var(--sd-border);
    border-radius: 8px;
    background: #fbfcfe;
    color: var(--sd-text-main);
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.35;
    word-break: break-word;
}

.sd-widget-links li a img,
.sd-widget-links-inline a img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.sd-widget-posts li:last-child a,
.sd-widget-categories li:last-child > a,
.sd-widget-menu li:last-child > a,
.sd-widget-archive li:last-child a {
    border-bottom: 0;
}

.sd-widget-links li:last-child a {
    margin-bottom: 0;
}

.sd-widget-posts li a:hover,
.sd-widget-categories li a:hover,
.sd-widget-menu li a:hover,
.sd-widget-archive li a:hover {
    color: var(--sd-primary);
}

.sd-widget-links li a:hover {
    color: var(--sd-primary);
    border-color: rgba(var(--sd-primary-rgb), 0.28);
    background: rgba(var(--sd-primary-rgb), 0.06);
}

.sd-widget-categories .sub-menu,
.sd-widget-menu .sub-menu {
    display: none;
    list-style: none;
    padding-left: 0.85rem;
    margin: 0.2rem 0 0.35rem;
    border-left: 1px solid var(--sd-border);
}

.sd-widget-categories li.has-children > a,
.sd-widget-menu li.has-children > a {
    cursor: pointer;
    position: relative;
    padding-right: 1.4rem;
}

.sd-widget-categories li.has-children > a::after,
.sd-widget-menu li.has-children > a::after {
    content: "\F282";
    font-family: "bootstrap-icons";
    position: absolute;
    right: 0;
    color: #98a2b3;
    font-size: 0.68rem;
    transition: transform 0.18s ease;
}

.sd-widget-categories li.has-children.open > a::after,
.sd-widget-menu li.has-children.open > a::after {
    transform: rotate(180deg);
}

.sd-widget-categories li.has-children.open > .sub-menu,
.sd-widget-menu li.has-children.open > .sub-menu {
    display: block;
}

.sd-widget-count,
.sd-widget-post-date {
    color: #98a2b3;
    font-size: 0.78rem;
    font-weight: 500;
}

.sd-widget-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.sd-tag,
.tag-link {
    display: inline-flex;
    align-items: center;
    color: var(--sd-text-muted);
    background: var(--sd-surface-muted);
    border: 1px solid var(--sd-border);
    border-radius: 6px;
    padding: 0.22rem 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.sd-tag:hover,
.tag-link:hover {
    color: var(--sd-primary);
    border-color: rgba(var(--sd-primary-rgb), 0.3);
    background: rgba(var(--sd-primary-rgb), 0.08);
}

.sd-widget-search {
    position: relative;
}

.sd-widget-search-input {
    width: 100%;
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 0.5rem 2.35rem 0.5rem 0.65rem;
    color: var(--sd-text-main);
    outline: none;
}

.sd-widget-search-input:focus {
    border-color: rgba(var(--sd-primary-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--sd-primary-rgb), 0.12);
}

.sd-widget-search-btn {
    position: absolute;
    top: 50%;
    right: 0.25rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--sd-primary);
    padding: 0.45rem 0.65rem;
}

.sd-widget-comments {
    display: flex;
    flex-direction: column;
    gap: 0.62rem;
}

.sd-widget-comments li {
    display: flex;
    gap: 0.62rem;
    padding: 0.68rem;
    border: 1px solid var(--sd-border);
    border-radius: 8px;
    background: #fbfcfe;
    font-size: 0.88rem;
}

.sd-widget-comments li:hover {
    border-color: rgba(var(--sd-primary-rgb), 0.22);
    background: #fff;
}

.sd-widget-comments li:last-child {
    border-bottom: 1px solid var(--sd-border);
}

.sd-widget-comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--sd-surface-muted);
}

.sd-widget-comment-body {
    flex: 1;
    min-width: 0;
}

.sd-widget-comment-head {
    display: flex;
    flex-direction: column;
    gap: 0.16rem;
    margin-bottom: 0.28rem;
}

.sd-widget-comments .comment-author {
    color: var(--sd-primary);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
}

.sd-widget-comment-head a {
    color: var(--sd-text-main);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sd-widget-comment-head a:hover {
    color: var(--sd-primary);
}

.sd-widget-comments .comment-excerpt {
    display: -webkit-box;
    color: var(--sd-text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sd-widget-comment-date {
    display: inline-flex;
    align-items: center;
    margin-top: 0.34rem;
    color: #94a3b8;
    font-size: 0.76rem;
    line-height: 1.2;
}

.sd-widget-comment-date::before {
    content: "\F293";
    font-family: "bootstrap-icons";
    margin-right: 0.28rem;
    font-size: 0.72rem;
}

.sd-widget-banner,
.sd-widget-siteinfo-logo {
    border-radius: var(--sd-radius);
}

/* Article detail */
.post-header {
    text-align: left;
    margin-bottom: 1rem;
}

.post-header h1 {
    color: var(--sd-text-main);
    font-size: 1.55rem;
    font-weight: 760;
    line-height: 1.35;
    letter-spacing: 0;
}

.post-content {
    color: #2f3b52;
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow-sm);
    padding: 1.25rem;
    font-size: 0.95rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--sd-text-main);
    font-weight: 760;
    line-height: 1.35;
    margin-top: 1.5rem;
    margin-bottom: 0.65rem;
}

.post-content p {
    margin-bottom: 0.95rem;
}

.post-content img {
    display: block;
    height: auto;
    margin: 1rem auto;
    border-radius: var(--sd-radius);
}

.post-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0 1.15rem;
    overflow-x: auto;
    border-collapse: separate;
    border-spacing: 0;
    color: #334155;
    font-size: 0.92rem;
    line-height: 1.6;
}

.post-content thead {
    background: #f7f9fc;
}

.post-content th,
.post-content td {
    min-width: 120px;
    padding: 0.68rem 0.82rem;
    border-right: 1px solid var(--sd-border);
    border-bottom: 1px solid var(--sd-border);
    vertical-align: top;
}

.post-content th {
    color: var(--sd-text-main);
    font-weight: 720;
    white-space: nowrap;
}

.post-content tr th:first-child,
.post-content tr td:first-child {
    border-left: 1px solid var(--sd-border);
}

.post-content thead tr:first-child th {
    border-top: 1px solid var(--sd-border);
}

.post-content thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.post-content thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.post-content tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.post-content tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.post-content tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.post-content tbody tr:hover {
    background: #f8fafc;
}

.post-featured-image img,
.page-featured-image img {
    border-radius: var(--sd-radius) !important;
}

.author-bio-card {
    background: var(--sd-surface) !important;
}

.nav-card {
    color: var(--sd-text-main);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.nav-card:hover {
    color: var(--sd-primary);
    border-color: rgba(var(--sd-primary-rgb), 0.35) !important;
    transform: translateY(-1px);
}

.related-card img {
    transition: transform 0.28s ease;
}

.related-card:hover img {
    transform: scale(1.04);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Comments */
.comment-item {
    border: 1px solid var(--sd-border) !important;
    border-radius: var(--sd-radius);
    padding: 0.85rem;
    box-shadow: var(--sd-shadow-sm) !important;
}

.comment-avatar {
    border-radius: 50%;
}

.form-control {
    border-radius: 6px;
}

.form-control:focus {
    border-color: rgba(var(--sd-primary-rgb), 0.55) !important;
    box-shadow: 0 0 0 3px rgba(var(--sd-primary-rgb), 0.12) !important;
}

/* Pagination */
.pagination {
    gap: 0.45rem;
}

.page-link {
    color: var(--sd-text-muted);
    border: 1px solid var(--sd-border);
    border-radius: 6px !important;
    font-weight: 700;
    min-width: 34px;
    text-align: center;
}

.page-link:hover {
    color: var(--sd-primary);
    background: rgba(var(--sd-primary-rgb), 0.08);
    border-color: rgba(var(--sd-primary-rgb), 0.25);
}

.page-item.active .page-link {
    background: var(--sd-primary);
    border-color: var(--sd-primary);
}

/* Footer */
.footer-main {
    background: #101828;
    color: #aab4c4;
    padding: 1.6rem 0 1rem;
}

.footer-title {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 750;
    margin-bottom: 0.75rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.45rem;
}

.footer-links a,
.footer-links span {
    color: #aab4c4;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 1.4rem;
    padding-top: 1rem;
    font-size: 0.84rem;
}

/* Utilities */
.x-small {
    font-size: 0.76rem;
}

.transition-all {
    transition: all 0.2s ease;
}

.transition-transform {
    transition: transform 0.28s ease;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-opacity-100:hover {
    opacity: 1 !important;
}

.bg-primary-light {
    background: rgba(var(--sd-primary-rgb), 0.08) !important;
}

.hover-primary:hover {
    color: var(--sd-primary) !important;
}

@media (max-width: 991.98px) {
    .navbar-nav {
        align-items: stretch;
        padding-top: 0.75rem;
    }

    .sidebar {
        position: static;
        margin-top: 1.5rem;
    }

    .post-header h1 {
        font-size: 1.35rem;
    }

    .post-content {
        padding: 1rem;
    }
}

@media (max-width: 767.98px) {
    main.container {
        padding-top: 1rem !important;
    }

    .post-card .row,
    .post-card .col-md-4 a,
    .post-card img {
        min-height: 0;
    }

    .post-card .col-md-4 {
        width: 100%;
        flex: 0 0 auto;
        padding: 0.85rem 0.85rem 0;
    }

    .post-card .col-md-4 a {
        height: auto;
    }

    .post-card img {
        aspect-ratio: 16 / 9;
        width: 100%;
    }

    .archive-header,
    .section-title {
        padding: 0.8rem !important;
    }
}
