/* ==========================================================================
   Xiangji modern design layer
   --------------------------------------------------------------------------
   Astroblog-inspired editorial styling layered on top of the Source theme.
   Loaded after assets/built/screen.css via default.hbs.
   Sections:
     0. Design tokens
     1. Base + typography
     2. Navigation
     3. Homepage hero
     4. Section heading + search
     5. Post cards
     6. Topics band
     7. Footer
     8. Article + content
     9. Responsive
   ========================================================================== */

/* 0. Design tokens
   -------------------------------------------------------------------------- */

:root {
    color-scheme: light dark;

    /* ---- palette (light) ---- */
    --xj-ink: #17242b;
    --xj-ink-soft: #5c6b73;
    --xj-paper: #f7f6f1;
    --xj-paper-deep: #ecede7;
    --xj-line: #d9dfd8;
    /* 品牌色取自 logo 渐变：#469bff（蓝）→ #601ef9（靖紫）→ #b300ff（紫） */
    --xj-brand: #601ef9;          /* 文字 / 链接 / 标签 */
    --xj-brand-solid: #601ef9;    /* 实底按钮 */
    --xj-brand-deep: #4a12c9;
    --xj-point: #b300ff;
    --xj-blue: #469bff;
    --xj-mint: #b9f1d1;
    --xj-on-mint: #17242b;
    --xj-dark: #1b1038;           /* 深色专题带与页脚 */
    --xj-code-bg: #17242b;
    --background-color: var(--xj-paper);

    --font-sans: Inter, "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-serif: "EB Garamond", Georgia, "Noto Serif SC", "Songti SC", "Source Han Serif SC", "STSong", serif;
    --font-serif-alt: Georgia, "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;

    --container-width: 1180px;
    --grid-gap: 40px;

    --color-darker-gray: var(--xj-ink);
    --color-primary-text: var(--xj-ink);
    --color-secondary-text: var(--xj-ink-soft);
    --color-border: var(--xj-line);
    --color-light-gray: var(--xj-paper-deep);
    --color-lighter-gray: rgb(23 36 43 / 0.05);
}

/* 暗色配色：用户显式选择 data-theme="dark" 时生效 */
:root[data-theme="dark"] {
    color-scheme: dark;
    --background-color: var(--xj-paper);
    --xj-ink: #eceaf6;
    --xj-ink-soft: #a8a3c2;
    --xj-paper: #0f0c1b;
    --xj-paper-deep: #1b1631;
    --xj-line: #2e2749;
    --xj-brand: #a78bfa;
    --xj-brand-solid: #6d3ff5;
    --xj-brand-deep: #c4b5fd;
    --xj-point: #c77dff;
    --xj-blue: #6ba8ff;
    --xj-mint: #9fe7bd;
    --xj-dark: #090612;
    --xj-code-bg: #1b1631;
    --color-lighter-gray: rgb(255 255 255 / 0.06);
    --ghost-accent-color: #7c5cff;
}

/* 用户显式选择浅色时锁定浅色（即使系统是暗色） */
:root[data-theme="light"] {
    color-scheme: light;
}

/* 无 JS / 未加载脚本时跟随系统 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --background-color: var(--xj-paper);
        --xj-ink: #eceaf6;
        --xj-ink-soft: #a8a3c2;
        --xj-paper: #0f0c1b;
        --xj-paper-deep: #1b1631;
        --xj-line: #2e2749;
        --xj-brand: #a78bfa;
        --xj-brand-solid: #6d3ff5;
        --xj-brand-deep: #c4b5fd;
        --xj-point: #c77dff;
        --xj-blue: #6ba8ff;
        --xj-mint: #9fe7bd;
        --xj-dark: #090612;
        --xj-code-bg: #1b1631;
        --color-lighter-gray: rgb(255 255 255 / 0.06);
        --ghost-accent-color: #7c5cff;
    }
}

/* 1. Base + typography
   -------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

body {
    color: var(--xj-ink);
    font-family: var(--font-sans);
    font-size: 1.6rem;
    line-height: 1.7;
}

.is-title,
.xj-hero-title,
.xj-topics-title,
.gh-container-title,
.gh-article-title,
.gh-card-title,
.gh-header-title,
.gh-cta-title,
.gh-footer-signup-header,
.gh-about-title,
.gh-featured-title,
.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4 {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.gh-button {
    color: #fff;
    font-weight: 700;
    background-color: var(--xj-brand-solid);
    border-radius: 0;
}

.gh-button:hover {
    background-color: var(--xj-ink);
    opacity: 1;
}

.gh-form {
    border-radius: 0;
    background-color: var(--xj-paper-deep);
}

/* 2. Navigation
   -------------------------------------------------------------------------- */

#gh-navigation {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 76px;
    background-color: var(--background-color, var(--xj-paper));
    border-bottom: 1px solid var(--xj-line);
}

#gh-navigation .gh-navigation-inner {
    height: 100%;
}

.gh-navigation-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.012em;
    white-space: nowrap;
}

.gh-navigation-logo-image {
    display: block;
    flex: 0 0 auto;
    max-height: 32px;
    width: auto;
}

.gh-navigation-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.012em;
    white-space: nowrap;
}

.gh-navigation .nav a {
    color: var(--xj-ink-soft);
    font-size: 1.5rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.gh-navigation .nav a:hover {
    color: var(--xj-brand);
    opacity: 1;
}

.gh-navigation .gh-icon-button {
    color: var(--xj-ink);
}

/* Turn the outbound "开始使用" nav item into a compact CTA button */
.gh-navigation .nav a[href^="https://www.xiangjifanyi.com"] {
    padding: 8px 14px;
    color: #fff;
    background-color: var(--xj-brand-solid);
}

.gh-navigation .nav a[href^="https://www.xiangjifanyi.com"]::after {
    margin-left: 3px;
    font-size: 0.85em;
    content: "↗";
}

.gh-navigation .nav a[href^="https://www.xiangjifanyi.com"]:hover {
    color: #fff;
    background-color: var(--xj-dark);
    opacity: 1;
}

/* Theme toggle (light / dark) */
.xj-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--xj-ink);
}

.xj-theme-toggle svg {
    width: 18px;
    height: 18px;
}

.xj-theme-toggle .xj-icon-sun {
    display: none;
}

.xj-theme-toggle .xj-icon-moon {
    display: block;
}

:root[data-theme="dark"] .xj-theme-toggle .xj-icon-sun {
    display: block;
}

:root[data-theme="dark"] .xj-theme-toggle .xj-icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .xj-theme-toggle .xj-icon-sun {
        display: block;
    }

    :root:not([data-theme]) .xj-theme-toggle .xj-icon-moon {
        display: none;
    }
}

.xj-theme-toggle.is-desktop {
    display: inline-flex;
}

.xj-theme-toggle.is-mobile {
    display: none;
}

@media (max-width: 767px) {
    #gh-navigation .gh-navigation-brand {
        grid-template-columns: 1fr auto auto auto;
    }

    .xj-theme-toggle.is-desktop {
        display: none;
    }

    .xj-theme-toggle.is-mobile {
        display: inline-flex;
    }
}

.is-left-logo .gh-navigation-menu {
    justify-content: flex-end;
    margin-left: 16px;
    margin-right: 24px;
}

/* 3. Homepage hero
   -------------------------------------------------------------------------- */

.xj-hero {
    padding-top: 64px;
    padding-bottom: 40px;
}

.xj-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 64px;
}

.xj-hero-copy {
    max-width: 720px;
}

.xj-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--xj-brand);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.xj-eyebrow-dot {
    width: 7px;
    height: 7px;
    background-color: var(--xj-point);
    border-radius: 50%;
}

.xj-hero-title {
    margin: 18px 0 20px;
    font-size: clamp(4rem, 5.2vw, 7rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.xj-hero-title span {
    color: transparent;
    background-image: linear-gradient(96deg, var(--xj-blue), var(--xj-brand) 52%, var(--xj-point));
    -webkit-background-clip: text;
    background-clip: text;
}

.xj-hero-desc {
    max-width: 540px;
    margin: 0;
    color: var(--xj-ink-soft);
    font-size: 1.7rem;
    line-height: 1.75;
}

.xj-hero-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-top: 30px;
}

.xj-hero-button {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    color: #fff;
    background-color: var(--xj-brand-solid);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: background-color 0.2s ease;
}

.xj-hero-button:hover {
    color: #fff;
    background-color: var(--xj-dark);
    opacity: 1;
}

.xj-hero-note {
    color: var(--xj-ink-soft);
    font-size: 1.2rem;
}

.xj-stamp {
    display: flex;
    flex: 0 0 186px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 186px;
    height: 186px;
    border: 1px solid var(--xj-ink);
    border-radius: 50%;
    transform: rotate(8deg);
}

.xj-stamp-word {
    font-family: var(--font-serif);
    font-size: 4rem;
    line-height: 1;
}

.xj-stamp-line {
    width: 54px;
    height: 1px;
    margin: 14px 0 10px;
    background-color: var(--xj-point);
}

.xj-stamp-caption {
    color: var(--xj-ink-soft);
    font-size: 8px;
    line-height: 1.6;
    letter-spacing: 0.16em;
    text-align: center;
}

/* 4. Section heading + search
   -------------------------------------------------------------------------- */

.gh-container {
    margin-top: 56px;
}

:is(.paged, .tag-template, .author-template) .gh-container:not(.has-sidebar) .gh-container-title,
.gh-navigation + .gh-container .gh-container-title {
    display: block;
}

.gh-container:not(.has-sidebar) :is(.gh-container-heading, .gh-container-title, .gh-main, .gh-more) {
    grid-column: 1 / -1;
}

.gh-container-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.gh-section-label {
    margin: 0 0 8px;
    color: var(--xj-brand);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.gh-container-title {
    margin: 0;
    padding: 0;
    font-size: clamp(2.8rem, 2vw + 2rem, 3.6rem);
    line-height: 1.2;
    text-transform: none;
    letter-spacing: -0.01em;
    border: 0;
}

.xj-search {
    position: relative;
    width: min(320px, 100%);
}

.xj-search label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.xj-search-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    color: var(--xj-ink-soft);
    border-bottom: 1px solid var(--xj-ink);
}

.xj-search-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.xj-search-wrap input {
    flex: 1;
    min-width: 0;
    color: var(--xj-ink);
    font-size: 1.3rem;
    background: transparent;
    border: 0;
    outline: 0;
}

.xj-search-wrap input::placeholder {
    color: #98a1a6;
}

.xj-search-wrap kbd {
    padding: 0 5px;
    color: #98a1a6;
    font-family: var(--font-sans);
    font-size: 1.1rem;
    border: 1px solid var(--xj-line);
}

.xj-search-empty {
    position: absolute;
    right: 0;
    left: 0;
    margin: 8px 0 0;
    color: var(--xj-brand);
    font-size: 1.2rem;
}

/* 5. Post cards
   -------------------------------------------------------------------------- */

.gh-card-link {
    gap: 16px;
}

.gh-card-image {
    aspect-ratio: 1.5;
    overflow: hidden;
    background-color: var(--xj-paper-deep);
}

.gh-card-image img {
    transition: transform 0.5s ease;
}

.gh-card-link:hover .gh-card-image img {
    transform: scale(1.04);
}

.gh-card-image::after {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--xj-on-mint);
    font-size: 1.7rem;
    line-height: 1;
    content: "↗";
    background-color: var(--xj-mint);
}

.gh-card-title {
    line-height: 1.4;
}

.gh-card-link:hover .gh-card-title {
    color: var(--xj-brand);
    opacity: 1;
}

.gh-card-excerpt {
    margin-top: 10px;
    color: var(--xj-ink-soft);
    font-size: 1.4rem;
    line-height: 1.75;
    -webkit-line-clamp: 3;
}

.gh-card-meta {
    margin-top: 14px;
    color: var(--xj-ink-soft);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.gh-card-meta .gh-card-date {
    color: var(--xj-ink-soft);
}

.gh-container.is-grid .gh-feed {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    row-gap: 56px;
}

.gh-container.is-grid .gh-card::before,
.gh-container.is-grid .gh-card::after {
    display: none;
}

.gh-container.is-list .gh-card + .gh-card::before {
    background-color: var(--xj-line);
}

/* 6. Topics band
   -------------------------------------------------------------------------- */

.xj-topics {
    margin-top: 88px;
    padding-top: 72px;
    padding-bottom: 84px;
    color: #fff;
    background-color: var(--xj-dark);
}

.xj-topics-inner {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 80px;
}

.xj-topics-intro .gh-section-label {
    color: var(--xj-mint);
}

.xj-topics-title {
    margin: 6px 0 0;
    color: #fff;
    font-size: clamp(2.8rem, 2vw + 2rem, 3.6rem);
}

.xj-topic-list {
    border-top: 1px solid rgb(255 255 255 / 0.28);
}

.xj-topic-item {
    display: grid;
    grid-template-columns: 38px 1fr auto 22px;
    gap: 15px;
    align-items: center;
    padding: 19px 0;
    color: #fff;
    border-bottom: 1px solid rgb(255 255 255 / 0.28);
}

.xj-topic-index,
.xj-topic-count {
    color: #9fb0b6;
    font-size: 1.2rem;
}

.xj-topic-name {
    font-family: var(--font-serif);
    font-size: 2.1rem;
    font-weight: 500;
}

.xj-topic-arrow {
    color: var(--xj-mint);
    font-size: 1.8rem;
    font-weight: 400;
}

.xj-topic-item:hover {
    opacity: 1;
}

.xj-topic-item:hover .xj-topic-name {
    color: var(--xj-mint);
}

/* 7. Footer
   -------------------------------------------------------------------------- */

.gh-footer {
    margin-top: 96px;
    color: #a9bac0;
    font-size: 1.4rem;
    background-color: var(--xj-dark);
}

/* Join the topics band and footer into one dark block (the inline
   homepage script sits between them, so use a general sibling) */
.xj-topics ~ .gh-footer {
    margin-top: 0;
    border-top: 1px solid rgb(255 255 255 / 0.12);
}

.gh-footer a:not(.gh-button) {
    color: inherit;
}

.gh-footer a:not(.gh-button):hover {
    color: var(--xj-mint);
    opacity: 1;
}

.gh-footer-inner {
    padding: 64px 0 40px;
}

.xj-footer-main {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgb(255 255 255 / 0.16);
}

.xj-footer-brand {
    max-width: 420px;
}

.xj-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 2rem;
    font-weight: 800;
}

.xj-footer-logo img {
    max-height: 34px;
    width: auto;
}

.xj-footer-desc {
    margin: 16px 0 0;
    color: #8fa1a7;
    font-size: 1.4rem;
    line-height: 1.7;
}

.xj-footer-side {
    display: flex;
    align-items: center;
    gap: 28px;
}

.xj-footer-cta {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    transition: color 0.2s ease;
}

.xj-footer-cta:hover {
    color: var(--xj-mint);
    opacity: 1;
}

.xj-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 34px;
}

.xj-footer-copyright {
    margin: 0;
    color: #7d9096;
    font-size: 1.3rem;
}

.xj-footer-tagline {
    margin: 0;
    color: #7d9096;
    font-size: 1.3rem;
}

.gh-footer .gh-social-links {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.gh-footer .gh-social-links a {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: #dfe7e9;
    border: 1px solid rgb(255 255 255 / 0.18);
}

.gh-footer .gh-social-links a:hover {
    color: var(--xj-dark);
    background-color: var(--xj-mint);
    border-color: var(--xj-mint);
}

.gh-footer .gh-social-links svg {
    width: 18px;
    height: 18px;
}

/* 小红书：保留品牌红底白标设计 */
.gh-footer .gh-social-links a[aria-label="小红书"] {
    color: #fff;
    background-color: #ff2442;
    border-color: #ff2442;
    border-radius: 9px;
}

.gh-footer .gh-social-links a[aria-label="小红书"]:hover {
    color: #fff;
    background-color: #e31d3b;
    border-color: #e31d3b;
}

.gh-footer .gh-social-links a[aria-label="小红书"] svg {
    width: 20px;
    height: 20px;
}

/* 8. Article + content
   -------------------------------------------------------------------------- */

.gh-article-header {
    margin: clamp(40px, 3.6vw + 26px, 72px) 0 36px;
}

.gh-article-tag {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--xj-brand);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.gh-article-title {
    font-size: clamp(3.4rem, 1.4vw + 2.8rem, 5.6rem);
    line-height: 1.16;
}

.gh-article-excerpt {
    margin-top: 18px;
    color: var(--xj-ink-soft);
    font-size: 1.85rem;
    line-height: 1.6;
}

.gh-article-image {
    margin-top: 44px;
}

.gh-article-image figcaption {
    margin-top: 12px;
    color: var(--xj-ink-soft);
    font-size: 1.3rem;
    text-align: center;
}

.gh-content {
    color: var(--xj-ink);
    font-size: 1.75rem;
    line-height: 1.95;
}

.gh-content h2 {
    font-size: 2.9rem;
}

.gh-content h3 {
    font-size: 2.2rem;
}

.gh-content a {
    color: var(--xj-brand);
    text-decoration: underline;
    text-decoration-color: var(--xj-mint);
    text-underline-offset: 3px;
}

.gh-content a:hover {
    color: var(--xj-point);
    opacity: 1;
}

.gh-content > blockquote {
    padding: 6px 26px;
    color: var(--xj-ink-soft);
    background-color: var(--xj-paper-deep);
    border-left: 3px solid var(--xj-brand);
}

.gh-content :not(pre) > code {
    background-color: var(--xj-paper-deep);
}

.gh-content pre {
    color: var(--xj-mint);
    background-color: var(--xj-code-bg);
}

.gh-content figcaption,
.gh-content .kg-caption {
    color: var(--xj-ink-soft);
}

.gh-archive-wrapper .gh-article-title {
    font-size: clamp(3.2rem, 1.4vw + 2.6rem, 4.8rem);
}

/* Align the tag/author archive header with the full-width post grid */
.gh-archive:not(.has-sidebar):not(.has-image) .gh-archive-inner {
    grid-column: 1 / -1;
}

.gh-archive-wrapper {
    max-width: 720px;
}

.gh-archive .gh-article-excerpt {
    margin-top: 14px;
}

/* 9. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .xj-topics-inner {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .xj-footer-main {
        flex-direction: column;
    }
}

@media (max-width: 767px) {
    #gh-navigation {
        height: 64px;
    }

    .gh-navigation-title {
        font-size: 1.8rem;
    }

    .xj-hero {
        padding-top: 44px;
        padding-bottom: 30px;
    }

    .xj-hero-inner {
        gap: 32px;
    }

    .xj-hero-title {
        font-size: clamp(3.6rem, 9vw, 5.2rem);
    }

    .xj-stamp {
        flex-basis: 120px;
        width: 120px;
        height: 120px;
    }

    .xj-stamp-word {
        font-size: 2.8rem;
    }

    .xj-stamp-line {
        width: 38px;
        margin: 9px 0 7px;
    }

    .xj-stamp-caption {
        font-size: 7px;
    }

    .gh-container-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .xj-search {
        width: 100%;
    }

    .gh-container.is-grid .gh-feed {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 40px;
    }

    .gh-card-image::after {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 1.5rem;
    }

    .xj-footer-side {
        gap: 18px;
    }
}

@media (max-width: 480px) {
    .xj-hero-inner {
        display: block;
    }

    .xj-stamp {
        margin: 34px 0 0 auto;
    }

    .xj-hero-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .gh-container.is-grid .gh-feed {
        grid-template-columns: 1fr;
    }

    .xj-footer-side {
        flex-wrap: wrap;
        gap: 16px 24px;
    }

    .xj-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}
