@charset "utf-8";

:root,
:root[data-theme="light"] {
    --bg: #fdfdfd;
    --text: #333333;
    --text-primary: var(--text);


    --sidebar-bg: #f5f5f5;
    --accent: #4c9aff;

    --text-secondary: #666666;

    --tag-bg: #e0e0e0;
    --tag-color: #555555;
    --post-bg: #ffffff;
    --border-color: #eaeaea;
}

@media (prefers-color-scheme: dark){
    :root{
        /* 基础背景与文字 */
        --bg: #121212;               /* 页面背景 */
        --text: #cccccc;             /* 主文字 */
        --text-primary: var(--text);

        /* 边栏和强调色 */
        --sidebar-bg: #1e1e1e;       /* 侧栏背景 */
        --accent: #4c9aff;           /* 保持亮色强调，和 light 一致 */

        /* 辅助文字与次级元素 */
        --text-secondary: #aaaaaa;

        /* 标签和卡片 */
        --tag-bg: #2a2a2a;
        --tag-color: #cccccc;
        --post-bg: #1a1a1a;          /* 文章背景 */
        --border-color: #333333;     /* 边框 */
    }
}

html {
    font-size: 16px;
}

body {
    color: var(--text);
    background-color: var(--bg);
    font: 1rem/1.5 system-ui, "-apple-system", "Segoe UI", sans-serif, "Helvetica Neue", Tahoma, Verdana, "Microsoft YaHei", Arial;
    clear: both;
}

*,
*::before,
*::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    border: none;
    list-style: none;
    text-decoration: none;
    font-family: inherit;
    outline: 0;
}

a {
    color: var(--text-strong);
}

a:hover {
    color: var(--text-stronger);
}


img {
    max-width: 100%;
}

img[src=''] {
    visibility: hidden;
}

h1 {
    font-size: 2.2rem;
}

h2 {
    font-size: 1.9rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.2rem;
}

h5 {
    font-size: 1.0rem;
}

small {
    font-size: 0.6rem;
}




body {
    font-size: 16px;
    line-height: 1.75;
}

/* ----------------------------
   布局
---------------------------- */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}


.site-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--sidebar-bg);

    position: sticky;
    top: 0;

    height: 100vh;
    width: 280px;
    flex-shrink: 0;

    & .app-info {
        display: block;
    }

}
@media (max-width: 960px) {
    .site-info {
        width: 200px;
        flex-shrink: 0;
    }
}

.site-title {
    display: grid;
    grid-template-areas:
        "avatar"
        "name"
        "bio"
        "tags";
    grid-template-rows: auto;
    grid-gap: 12px;
    justify-items: center;
    align-content: start;
    padding: 24px 16px;
    width: 100%;
   

    border-right: 1px solid var(--border-color);
    flex-shrink: 0;



    min-height: 80vh;

    & .avatar {
        grid-area: avatar;
    }

    & .name {
        grid-area: name;
    }

    & .bio {
        grid-area: bio;
    }

    & .tag-cloud {
        grid-area: tags;
    }


    & .name {
        text-align: center;
        font-weight: bold;
    }

    & .bio {
        text-align: center;
        font-size: 14px;
        color: var(--text-secondary);
    }

    & .avatar {
        width: 90px;
        height: 90px;
        border-radius: 50%;
        background-color: var(--accent);

        border: 3px solid #FFF;
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);

        background-image: url('../assets/avatar.jpg');
        background-size: cover;
        background-repeat: no-repeat;
        background-position: top center;
    }



}

.tag-cloud {
    --max-lines: 5;
    --line-height: 28px;
    --gap: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;

    margin-top: 2rem;
    gap: var(--gap);
    max-height: calc(var(--max-lines) * (var(--gap) + var(--line-height)));
    position: relative;
    transition: max-height 0.3s ease;
    width: 100%;

    --tagcolor: color-mix(in srgb, var(--text), white 20%);

    & a {
        display: inline-block;
        line-height: var(--line-height);

        border-radius: 3px;

        text-decoration: underline dotted 1px;

        transition: all 0.2s ease;
    }


    & a:hover {
        color: #FFF;
        border-color: color-mix(in srgb, var(--tag-color, #999));
        background-color: var(--tag-color, #999);

    }

    & button[data-act="expand-tag-cloud"] {
        position: absolute;
        top: 0;
        right: -10px;
        height: 32px;
        width: 32px;
        font-size: 1.2rem;
        display: none;
        color: hsl(from var(--text) h s l / 0.5);
        background-color: transparent;
        text-shadow: 0 0 4px rgba(0, 0, 0, 0.1);

        cursor: pointer;

    }

    & button[data-act="expand-tag-cloud"]:hover {
        color: hsl(from var(--text) h s l / 0.9);
    }



}

footer.site-footer {
    display: none;
}

@media (max-width: 768px) {
    .container { flex-direction: column; }

    .site-info {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);

        position: static;
        top: 0;

        & .site-title {
            grid-template-areas:
                "avatar name"
                "avatar bio"
                "tags tags";
            grid-template-columns: auto 1fr;
            grid-template-rows: auto;
            padding: 1rem;            
            padding: 1.2rem;
            gap: 0;
            justify-items: start;

            align-items: center;

            min-height: 0;
            width: 100%;

            & .avatar {
                width: 70px;
                height: 70px;
                margin-right: 1rem;
            }
        }

        & .app-info {
            display: none;
        }

    }

    .tag-cloud {
        --max-lines: 1;

        overflow: hidden;
        margin-top: 1rem;
    }

    .tag-cloud.multi-line {
        padding-right: 1.5rem;

        & button[data-act="expand-tag-cloud"] {
            display: block;
        }
    }




    .tag-cloud.tag-cloud-expanded {
        --max-lines: 3;

        & button[data-act="expand-tag-cloud"] {
            display: none;
        }
    }

    footer.site-footer {
        display: flex;
    }
}




/* Feed */
main {
    padding: 1.8rem 1.4rem;
    flex-grow: 1;
}

.app-info {
    font-size: 12px;
    color: rgb(from var(--text) r g b / 50%);
    text-align: center;
    margin: 0 auto;
    padding: 1rem;

    a,
    p {
        font-size: 12px;
        color: rgb(from var(--text) r g b / 50%)
    }
}


/* 切换按钮 */
.feed-toolbar {
    margin-bottom: 16px;
}

.feed-toolbar button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    transition: 0.2s;
}

.feed-toolbar button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Post 样式 */
.feed.list .post {
    display: flex;
    flex-direction: column;
    background-color: var(--post-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.feed.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: auto;
    gap: 16px;
}

.feed.grid .post {
    display: flex;
    flex-direction: column;
    background-color: var(--post-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.post:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.post .meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.post .content {
    font-size: 15px;
}

@media (max-width: 960px) {

 

}


/* ----------------------------
   响应式：小屏幕变 header
---------------------------- */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }


    main {
        padding: 1.6rem 1rem;
    }



    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 12px 16px;
        gap: 8px;
    }

    .sidebar .avatar {
        margin: 0;
    }

    .sidebar .name,
    .sidebar .bio {
        text-align: left;
        font-size: 14px;
        flex-basis: 100%;
    }

    .sidebar .tag-cloud {
        justify-content: flex-start;
        flex-basis: 100%;
    }

    .feed-container {
        padding: 16px;
    }
}


.masonry {
     --masonry-item-width: 340px;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--masonry-item-width), 1fr));
    grid-auto-rows: 1px;
    gap: 16px;


    &>* {
        grid-row-end: span var(--row-span);

        &>* {
            padding: 12px;
            border-radius: 6px;
        }
    }

    @media (max-width: 768px) {
        .masonry {
            --masonry-item-width: 250px;
            grid-gap: 15px;
        }
    }

    @media (max-width: 480px) {
        .masonry {
            --masonry-item-width: 100%;
            grid-template-columns: 1fr;
        }
    }


}

