/* 转图网 · 内容信息流（中性色排版，无渐变/无光效） */
:root {
    --bg: #f6f6f4;
    --surface: #ffffff;
    --surface-2: #f1f1ee;
    --text: #161616;
    --text-2: #4b4b4b;
    --muted: #8a8a85;
    --line: #e5e5e0;
    --line-strong: #cfcfc9;
    --accent: #161616;
    --accent-contrast: #ffffff;
    --focus: rgba(22, 22, 22, .28);
    --radius: 10px;
    --radius-sm: 6px;
    --max: 760px;
    --feed: 700px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0d0d;
        --surface: #151515;
        --surface-2: #1c1c1c;
        --text: #f2f2f2;
        --text-2: #b8b8b8;
        --muted: #8c8c8c;
        --line: #262626;
        --line-strong: #383838;
        --accent: #f2f2f2;
        --accent-contrast: #111111;
        --focus: rgba(242, 242, 242, .32);
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color-scheme: light dark;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.lb-open {
    overflow: hidden;
}

::selection {
    background: var(--text);
    color: var(--surface);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

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

.wrap {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--text);
    color: var(--surface);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.brand-name {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: .1px;
}

.tagline {
    font-size: 12px;
    color: var(--muted);
    padding-left: 12px;
    border-left: 1px solid var(--line);
    line-height: 1.2;
    white-space: nowrap;
}

.search {
    margin-left: auto;
    min-width: 240px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .16s ease;
}

.search:focus-within {
    border-color: var(--line-strong);
}

.search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
}

.search input::placeholder {
    color: var(--muted);
}

.search button {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 5px;
    background: var(--text);
    color: var(--surface);
    display: grid;
    place-items: center;
    transition: opacity .16s ease;
}

.search button:hover {
    opacity: .82;
}

/* 信息流 */
main {
    min-height: 70vh;
    padding-bottom: 40px;
}

.feed {
    max-width: var(--feed);
    margin: 0 auto;
    padding: 24px 16px 0;
}

.feed-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 2px 16px;
    border-bottom: 1px solid var(--line);
}

.feed-title {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: .2px;
}

.feed-count {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.feed-clear {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 单条内容 */
.post {
    display: flex;
    gap: 14px;
    padding: 20px 2px;
    border-bottom: 1px solid var(--line);
}

.post-avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.post-body {
    flex: 1 1 auto;
    min-width: 0;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.post-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.post-chip {
    font-size: 11px;
    line-height: 1.5;
    padding: 0 6px;
    border-radius: 4px;
    border: 1px solid var(--line);
    color: var(--muted);
}

.post-title {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.5;
    letter-spacing: -.1px;
    color: var(--text);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-text {
    margin: 7px 0 0;
    font-size: 14px;
    line-height: 1.72;
    color: var(--text-2);
    white-space: pre-line;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 九宫格 */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 12px;
    max-width: 468px;
}

.post-grid[data-count="1"] {
    grid-template-columns: minmax(0, 180px);
}

.post-grid[data-count="2"],
.post-grid[data-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 312px;
}

.tile {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow: hidden;
    line-height: 0;
    cursor: zoom-in;
    aspect-ratio: 1 / 1;
}

.tile img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .18s ease;
}

.tile:hover img {
    opacity: .92;
}

.tile.is-broken img {
    display: none;
}

.tile.is-broken::before {
    content: "图片加载失败";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.post-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.post-count {
    font-size: 12px;
    color: var(--muted);
}

/* 加载更多 */
.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 22px 0 34px;
}

.load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    height: 40px;
    padding: 0 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.load-more:hover {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.load-more[aria-busy="true"] {
    opacity: .55;
    pointer-events: none;
}

.end-note {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 8px 0 34px;
}

/* 空状态 / 错误 */
.state {
    max-width: 520px;
    margin: 80px auto;
    padding: 0 24px;
    text-align: center;
}

.state-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    display: grid;
    place-items: center;
}

.state-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 650;
}

.state-text {
    margin: 0 0 20px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--muted);
}

.state-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    transition: background .16s ease, color .16s ease;
}

.state-link:hover {
    background: var(--text);
    color: var(--surface);
}

/* 骨架屏 */
.sk-card {
    display: flex;
    gap: 14px;
    padding: 20px 2px;
    border-bottom: 1px solid var(--line);
}

.sk-avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--surface-2);
    animation: sk-pulse 1.4s ease-in-out infinite;
}

.sk-box {
    flex: 1 1 auto;
    min-width: 0;
}

.sk-line {
    height: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    background: var(--surface-2);
    animation: sk-pulse 1.4s ease-in-out infinite;
}

.sk-line.short {
    width: 42%;
}

.sk-cover {
    height: 92px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    animation: sk-pulse 1.4s ease-in-out infinite;
}

@keyframes sk-pulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

/* 页脚 */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 22px 0 28px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* 灯箱 */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(8, 8, 8, .96);
    display: flex;
    flex-direction: column;
    color: #fff;
}

.lightbox[hidden] {
    display: none !important;
}

.lb-top {
    flex: 0 0 auto;
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lb-counter {
    font-size: 12px;
    opacity: .7;
    font-variant-numeric: tabular-nums;
}

.lb-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: background .16s ease;
}

.lb-close:hover {
    background: rgba(255, 255, 255, .18);
}

.lb-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 64px;
}

.lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 3px;
    user-select: none;
    -webkit-user-drag: none;
}

.lb-broken {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: background .16s ease;
}

.lb-nav:hover {
    background: rgba(255, 255, 255, .18);
}

.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-thumbs {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    padding: 12px 16px 18px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.lb-thumb {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    opacity: .5;
    transition: opacity .16s ease, border-color .16s ease;
}

.lb-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lb-thumb.is-active {
    border-color: #fff;
    opacity: 1;
}

@media (max-width: 720px) {
    .wrap { padding: 0 14px; }
    .header-inner {
        height: auto;
        padding: 10px 0 12px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .tagline { display: none; }
    .search {
        order: 3;
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }
    .feed { padding: 16px 12px 0; }
    .feed-head { padding: 0 2px 12px; }
    .post {
        gap: 12px;
        padding: 16px 2px;
    }
    .post-avatar { flex-basis: 38px; width: 38px; height: 38px; }
    .post-name { font-size: 12.5px; }
    .post-title { font-size: 15px; }
    .post-text { font-size: 13.5px; }
    .post-grid { max-width: 100%; }
    .post-grid[data-count="1"] { grid-template-columns: minmax(0, 60%); }
    .post-grid[data-count="2"],
    .post-grid[data-count="4"] { max-width: 72%; }
    .post-foot { font-size: 11.5px; }
    .lb-stage { padding: 0 8px; }
    .lb-nav {
        top: auto;
        bottom: 78px;
        transform: none;
        width: 36px;
        height: 36px;
        font-size: 19px;
    }
    .lb-prev { left: 12px; }
    .lb-next { right: 12px; }
    .lb-thumbs { justify-content: flex-start; padding: 8px 12px 14px; }
    .lb-thumb { width: 42px; height: 42px; }
    .state { margin: 60px auto; }
}

@media (max-width: 380px) {
    .brand-name { font-size: 15px; }
    .post-grid[data-count="2"],
    .post-grid[data-count="4"] { max-width: 78%; }
}

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