.bg-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-purple:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.page-link {
    color: #667eea;
}

.page-link:hover {
    color: #764ba2;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    border: none;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.477);
}

.post-cover,
.post-cover-detail,
.portfolio-cover,
.portfolio-cover-detail {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.post-cover.bg-gradient,
.portfolio-cover.bg-gradient,
.post-cover-detail.bg-gradient,
.portfolio-cover-detail.bg-gradient {
    min-height: 160px;
}

.portfolio-video {
    max-height: 520px;
    background: #000;
}

.card-animate {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.card-animate.card-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .card-animate {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ========== 列表卡片（文章 / 作品）可点击 ========== */
.list-card {
    overflow: hidden;
}

.list-card .card-title {
    transition: color 0.2s ease;
}

.list-card:hover .card-title {
    color: #667eea;
}

.list-card-action {
    position: relative;
    z-index: 2;
    width: fit-content;
}

.list-card .stretched-link::after {
    z-index: 1;
}

.list-card-grid {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

.hover-shadow {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-shadow:hover {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
    transform: translateY(-8px) scale(1.02);
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.post-content p {
    margin-bottom: 1.5rem;
}

/* 长文折叠（默认 18 行，超出后点击查看全文） */
.content-fold {
    position: relative;
}

.content-fold__inner {
    font-size: 1.1rem;
    line-height: 1.8;
    word-break: break-word;
}

.content-fold.is-collapsed .content-fold__inner {
    max-height: var(--fold-max-height, 32.4em);
    overflow: hidden;
}

.content-fold.is-collapsed:not(.is-short)::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2.75rem;
    height: 3.5rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 85%);
    z-index: 1;
}

.content-fold.is-short::before,
.content-fold:not(.is-collapsed)::before {
    display: none;
}

.content-fold__footer {
    margin-top: 0.75rem;
    position: relative;
    z-index: 2;
}

.content-fold.is-short .content-fold__footer {
    display: none;
}

.content-fold__toggle {
    min-width: 9rem;
}

.portfolio-description .content-fold__inner {
    font-size: 1rem;
}

.text-file-preview {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 0;
    max-height: min(70vh, 640px);
    overflow: auto;
}

.text-file-table th,
.text-file-table td {
    vertical-align: middle;
}

.site-messages .alert {
    margin-bottom: 0.5rem;
}

.site-messages .alert:last-child {
    margin-bottom: 0;
}

.w-fit {
    width: fit-content;
}

.text-purple {
    color: #6f42c1;
}

a {
    transition: all 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.bg-outline-purple {
    background-color: rgba(102, 126, 234, 0.08);
}

.nav-link:hover {
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.badge {
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.1);
}

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
    z-index: 1000;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.7);
}

.particle {
    position: absolute;
    pointer-events: none;
    opacity: 0.8;
    animation: particleFloat 4s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* ========== 站点头部 ========== */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.site-hero-title {
    font-size: clamp(1.35rem, 4vw, 2.5rem);
    line-height: 1.3;
    word-break: break-word;
}

.site-hero-sub {
    font-size: clamp(0.875rem, 2.5vw, 1.15rem);
}

/* ========== 登录 / 注册 ========== */
.page-auth .site-main {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    padding-top: 1.5rem;
    margin-bottom: 0;
}

.page-auth .site-main > .row {
    margin: 0;
}

.page-auth .site-main > .row > [class*="col-"] {
    padding: 0;
    max-width: 100%;
}

.page-auth .nav-gate-key {
    display: none;
}

.auth-page {
    padding: 1.25rem 1rem 2.5rem;
    background:
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(102, 126, 234, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 90% 80%, rgba(118, 75, 162, 0.1), transparent),
        linear-gradient(180deg, #f4f6fc 0%, #eef1f8 100%);
}

.auth-page-layout {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    background: #fff;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(102, 126, 234, 0.14), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.auth-panel-brand {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand-home {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.auth-brand-home:hover {
    color: #fff;
}

.auth-brand-icon-wrap {
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.auth-brand-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.auth-brand-desc {
    font-size: 0.95rem;
    line-height: 1.65;
    opacity: 0.92;
    margin-bottom: 0;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    opacity: 0.95;
}

.auth-feature-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.auth-brand-foot {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.auth-stat-item strong {
    font-size: 1.25rem;
    font-weight: 700;
}

.auth-stat-item span {
    font-size: 0.75rem;
    opacity: 0.85;
}

.auth-panel-form {
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form-header {
    border-bottom: 1px solid #eef0f4;
    padding-bottom: 1rem;
}

.auth-form-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #2d3748;
}

.auth-form-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: #adb5bd;
    font-size: 0.8rem;
}

.auth-form-divider::before,
.auth-form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e9ecef;
}

.auth-quick-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed #e9ecef;
}

.auth-quick-link {
    font-size: 0.85rem;
    color: #6c757d;
    text-decoration: none;
}

.auth-quick-link:hover {
    color: #667eea;
}

@media (max-width: 767.98px) {
    .page-auth .site-main {
        padding-top: 0.75rem;
    }

    .auth-page {
        min-height: auto;
        padding: 1.5rem 0.75rem 2.5rem;
    }

    .auth-page-layout {
        grid-template-columns: 1fr;
    }

    .auth-panel-brand {
        padding: 1.5rem 1.25rem;
    }

    .auth-brand-icon-wrap {
        width: 3rem;
        height: 3rem;
        font-size: 1.35rem;
        margin-bottom: 1rem;
    }

    .auth-brand-title {
        font-size: 1.35rem;
    }

    .auth-features {
        margin-top: 1rem;
    }

    .auth-features li {
        margin-bottom: 0.5rem;
    }

    .auth-panel-form {
        padding: 1.5rem 1.25rem;
    }

    .auth-stats {
        flex-direction: row;
        justify-content: flex-start;
    }
}

.auth-form .form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: #495057;
}

.auth-input-group {
    border-radius: 0.625rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.auth-input-group .input-group-text {
    background: #f4f6fb;
    border-color: #dee2e6;
    color: #667eea;
    min-width: 2.75rem;
    justify-content: center;
}

.auth-input-group .form-control,
.auth-form .auth-field {
    border-color: #dee2e6;
    padding: 0.65rem 0.875rem;
    font-size: 1rem;
    min-height: 2.75rem;
}

.auth-input-group .form-control:focus,
.auth-form .auth-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.auth-input-group:focus-within .input-group-text {
    border-color: #667eea;
    color: #5a6fd6;
}

.auth-submit-btn {
    padding: 0.7rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 0.625rem;
}

.auth-link {
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-form .form-text {
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.auth-form .invalid-feedback {
    font-size: 0.85rem;
}

/* ========== 通用内容区 ========== */
.content-card-body {
    padding: 1.25rem 1rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
}

.post-meta > span {
    white-space: nowrap;
}

.text-break {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ========== 移动端适配 ========== */
@media (max-width: 991.98px) {
    .sidebar-widgets {
        margin-top: 0.5rem;
    }

    .hover-shadow:hover {
        transform: translateY(-4px) scale(1.01);
    }
}

@media (max-width: 767.98px) {
    .site-header {
        margin-bottom: 1rem !important;
    }

    .site-main {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .content-card-body {
        padding: 1rem 0.875rem;
    }


    .portfolio-video {
        max-height: 240px;
    }

    .post-content {
        font-size: 1rem;
        line-height: 1.75;
    }

    .display-6 {
        font-size: calc(1.25rem + 1vw);
    }

    #back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .pagination .page-link {
        padding: 0.375rem 0.65rem;
        font-size: 0.9rem;
    }

    .about-avatar {
        width: min(160px, 60vw);
        height: min(160px, 60vw);
    }
}

@media (max-width: 575.98px) {
    .row.g-4 > [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-title {
        font-size: 1.05rem;
    }

    .btn-purple.btn-sm {
        font-size: 0.85rem;
        padding: 0.35rem 0.65rem;
    }
}

@media (min-width: 768px) {
    .content-card-body {
        padding: 2rem 2.5rem;
    }

    .auth-panel-form {
        padding: 2.25rem 2rem;
    }
}

@media (min-width: 992px) {
    .content-card-body {
        padding: 2.5rem 3rem;
    }
}

/* ========== 关于页（图标与文字分区，避免重叠） ========== */
.about-page-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.about-page-header-icon {
    display: block;
    font-size: 2.5rem;
    line-height: 1;
    width: 1em;
    height: 1em;
    color: #667eea;
}

.about-page-header-title {
    font-size: clamp(1.35rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
}

.about-avatar {
    width: min(200px, 72vw);
    height: min(200px, 72vw);
    max-width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.about-avatar-icon {
    font-size: clamp(3rem, 14vw, 5rem);
    line-height: 1;
}

.about-intro-copy {
    min-width: 0;
}

.about-intro-copy .lead {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
}

.about-block-title {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    column-gap: 0.65rem;
    row-gap: 0.25rem;
    align-items: start;
    margin: 0 0 1rem;
    padding-left: 0.85rem;
    border-left: 4px solid #667eea;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.45;
}

.about-block-title > i {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.35rem;
    line-height: 1.45;
    color: #667eea;
    margin-top: 0.05em;
}

.about-block-title > span {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    word-break: break-word;
}

.about-block-title-center {
    grid-template-columns: 2.25rem auto;
    justify-content: center;
    justify-items: start;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.about-contact-icon-wrap {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    line-height: 1;
}

.about-tip-layout {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    column-gap: 0.85rem;
    align-items: start;
}

.about-tip-alert-icon {
    grid-column: 1;
    font-size: 1.75rem;
    line-height: 1;
    margin-top: 0.15rem;
}

.about-tip-layout > div {
    grid-column: 2;
    min-width: 0;
}

@media (min-width: 576px) {
    .about-page-header {
        flex-direction: row;
        gap: 0.75rem;
    }

    .about-page-header-icon {
        font-size: 2rem;
    }
}

@media (max-width: 575.98px) {
    .about-intro .about-intro-copy {
        text-align: center;
    }

    .about-block-title,
    .about-block-title-center {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding-left: 0;
        border-left: none;
        border-top: 3px solid #667eea;
        padding-top: 0.75rem;
    }

    .about-block-title > i,
    .about-block-title > span {
        grid-column: 1;
    }

    .about-block-title > span {
        grid-row: 2;
    }
}

/* 详情页顶部返回箭头 */
.detail-back-bar {
    margin: 0 0 1rem;
    padding: 0;
}

.detail-back-btn {
    --detail-back-size: 2.75rem;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--detail-back-size);
    height: var(--detail-back-size);
    padding: 0;
    border: 1px solid rgba(102, 126, 234, 0.28);
    border-radius: 50%;
    background: linear-gradient(160deg, #ffffff 0%, #f3f5ff 55%, #eceffd 100%);
    color: #667eea;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow:
        0 2px 8px rgba(102, 126, 234, 0.12),
        0 6px 18px rgba(118, 75, 162, 0.1);
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.22s ease,
        color 0.22s ease;
}

.detail-back-btn__svg {
    display: block;
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.detail-back-btn:hover {
    transform: translateX(-4px);
    border-color: transparent;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow:
        0 4px 12px rgba(102, 126, 234, 0.35),
        0 10px 28px rgba(118, 75, 162, 0.28);
}

.detail-back-btn:hover .detail-back-btn__svg {
    transform: translateX(-1px);
}

.detail-back-btn:active {
    transform: translateX(-2px) scale(0.94);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.detail-back-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 3px;
}

@media (max-width: 575.98px) {
    .detail-back-btn {
        --detail-back-size: 2.5rem;
        font-size: 1.1rem;
    }
}

.navbar-blog {
    position: relative;
}

.nav-gate-key {
    position: absolute;
    right: max(1ch, env(safe-area-inset-right, 0px));
    top: 50%;
    transform: translateY(-50%);
    z-index: 1031;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.2rem;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-gate-key:hover,
.nav-gate-key:focus-visible {
    color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 991.98px) {
    .navbar-toggler-with-gate {
        margin-right: 1.85rem;
    }
}

.site-footer-icp {
    font-size: 0.8125rem;
    line-height: 1.6;
}

.site-footer-icp a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer-icp a:hover,
.site-footer-icp a:focus-visible {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: underline;
}
