/* index.css */
/*
    omg-by-clark.github.io: A website for sharing daily stories.
    Copyright (C) 2026  Chi (Clark) Zhang

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
*/
/* 用途：定义网页根元素的全局 CSS 变量（主要针对浅色模式），集中管理颜色以便后续维护 */
:root {
    --bg: #fffdf5;
    --text: #333;
    --card: #fff;
    --brand: #ff4757;
    --unliked: #ccc;
    --disliked: #57606f;
    --hot-border: #ff6b81;
    --button-grad: linear-gradient(45deg, #e64553, #fe640b);
    --kw-text: #5c5f77;
    --greeting-bg: #7c7f93;
    --vote-bg-neutral: hsl(233deg, 10%, 47%);
    --vote-bg-disliked: #7287fd;
    --read-more: #1e66f5;
    --post-list-marker: #1e66f5;
    --nsfw-color: #fe640b;
    --repost-color: #40a02b;
    --body-text: #4c4f69;
    --title-text: #121212;
}

/* 用途：定义深色模式下的 CSS 变量覆盖，当 body 带有 dark 类时自动生效，实现黑夜模式适配 */
body.dark {
    --bg: #1a1a1a;
    --text: #f0f0f0;
    --card: #2d2d2d;
    --brand: #ff6b81;
    --unliked: hsl(233deg, 10%, 47%);
    --disliked: #a4b0be;
    --hot-border: #ff6b81;
    --greeting-bg: #626880;
    --vote-bg-neutral: #333;
    --vote-bg-disliked: #7287fd;
    --read-more: #89dceb;
    --post-list-marker: hsl(217deg, 92%, 82%);
    --repost-color: #a6e3a1;
    --body-text: #c6d0f5;
    --title-text: hsl(40, 87%, 94%);
    --kw-text: #838ba7;
}

/* 用途：设置网页主体的基础字体、最大宽度、居中对齐、内外边距以及平滑的过渡动画 */
body {
    font-family: 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg);
    color: var(--text);
    transition: 0.3s; /* 防止全局超长单词撑破网页容器，强制在其越界时打破单词边界换行 */
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 用途：设置选择任何文本时都能显示 brand 色 */
::selection {
    background: hsla(355, 100%, 75%, 0.3);
}

/* 用途：设置页面顶部大标题的字体样式、颜色、大小，并禁止用户选中文本 */
.fuck-xiao-tian-cai {
    font-family: Consolas, Monaco, monospace;
    font-weight: bold;
    color: var(--brand);
    margin: 0;
    font-size: 1.6em;
    user-select: none;
    white-space: nowrap;
}

/* 用途：顶部导航区域的 Flexbox 布局，控制标题、搜索框和按钮组的水平排列及底部边框 */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(150, 150, 150, 0.1);
    flex-wrap: wrap;
}

/* 用途：顶部搜索框容器，占据中间空余位置，使用相对定位以便下拉列表绝对定位 */
.search-container {
    flex: 1;
    max-width: 400px;
    margin: 0 10px;
    position: relative;
    min-width: 250px;
}

/* 用途：定义输入框的具体样式，包括颜色、圆角、内边距和聚焦时的发光效果 */
#searchInput {
    width: 100%;
    padding: 8px 15px;
    border: 1px solid var(--unliked);
    border-radius: 20px;
    background: var(--card);
    color: var(--text);
    box-sizing: border-box;
    outline: none;
    transition: 0.3s;
    font-size: 0.9em;
}

#searchInput:focus {
    border-color: var(--brand);
    box-shadow: 0 0 5px rgba(255, 71, 87, 0.3);
}

/* 用途：当用户输入 # 时弹出的标签下拉列表，默认隐藏，自带滚动条 */
.keyword-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--unliked);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.keyword-dropdown.visible {
    display: block;
}

/* 用途：下拉列表里每一个标签选项的样式，增加行距，变成选择列表 */
.tag-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.95em;
    color: var(--text);
    border-bottom: 1px solid rgba(150, 150, 150, 0.1);
}

/* 用途：去掉下拉列表最后一项的底部边框，保持 UI 干净 */
.tag-dropdown-item:last-child {
    border-bottom: none;
}

/* 用途：鼠标悬停效果，背景颜色更深 (darker) */
.tag-dropdown-item:hover {
    background: rgba(128, 128, 128, 0.15);
}

.tag-dropdown-item:active {
    transform: none;
}

.tag-dropdown-item,
.command-dropdown-item {
    touch-action: manipulation;
}

.command-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.command-dropdown-item strong {
    color: var(--brand);
    font-weight: 700;
}

.command-dropdown-item span {
    color: var(--kw-text);
    font-size: 0.84em;
    line-height: 1.45;
}

/* 用途：搜索框下方用于展示已选中关键词的容器 */
.selected-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 99;
}

/* 用途：已被选中的关键词小药丸样式，包含删除按钮布局 */
.selected-keyword-chip {
    background: var(--brand);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3);
}

.selected-keyword-chip span {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.selected-keyword-chip span:hover {
    opacity: 1;
}

/* 用途：顶部导航栏右侧功能按钮组的容器排版，控制按钮间的间距和垂直居中 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    /* 确保屏幕小时可以自动换行 */
}

/* 用途：新增用户名问候语框样式，背景根据主题变色，文字垂直居中 */
.user-greeting {
    background: var(--greeting-bg);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: normal;
    display: none;
    /* 默认隐藏，JS检测到登录后再显示 */
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 用途：通用的胶囊型按钮样式，包括渐变背景、圆角、阴影、字体和基础动画设置 */
.btn-common {
    background: var(--button-grad);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: 0.3s;
    box-shadow: 0 2px 6px rgba(230, 69, 83, 0.2);
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 用途：鼠标悬停在通用按钮上时的浮动效果和阴影加深反馈 */
.btn-common:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(230, 69, 83, 0.4);
}

/* 用途：鼠标点击按下通用按钮时放大 1.1 倍，沿用旧版直接反馈。 */
.btn-common:active {
    transform: scale(1.1);
}

/* 用途：页面主体内容区域的并排布局，划分左侧帖子流和右侧热榜 */
.layout-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* 用途：左侧全部帖子列表区域的自适应宽度分配 */
.col-all {
    flex: 1;
    min-width: 0;
    margin-top: 25px;
}

/* 用途：右侧热搜排行榜区域的固定样式，包括特殊边框、微透明背景和自适应高度 */
.col-hot {
    flex: 1;
    min-width: 0;
    border: 2px solid var(--hot-border);
    border-radius: 12px;
    padding: 20px;
    background: hsla(351, 100%, 71%, 0.03);
    height: fit-content;
    margin-top: 25px;
}

/* 用途：移动端媒体查询，屏幕宽度小于768px时，将左右布局改为上下堆叠布局 */
@media (max-width: 768px) {
    .layout-container {
        flex-direction: column-reverse;
    }

    .col-hot {
        width: 100%;
        box-sizing: border-box;
    }
}

/* 用途：各个帖子列表（全部、热搜）上方的区块标题文字排版 */
.section-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 用途：单个帖子的基础卡片容器，移除默认背景色，设置底部边框作为分割线 */
.card {
    background: transparent;
    margin: 0;
    padding: 20px 5px;
    border-radius: 0;
    display: block;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1.5px solid var(--brand);
}

/* 用途：清除列表里最后一个帖子的底部边框，保持视觉整洁 */
.card:last-child {
    border-bottom: none;
}

/* 用途：卡片内帖子主标题的字体大小和颜色渲染 */
.card b {
    color: var(--title-text);
    font-size: 1.1em;
    display: block;
    margin-bottom: 5px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 用途：新增专门针对卡片内正文的文本截断和长单词换行控制 */
.post-body {
    /* 新增：双重保险，针对动态插入的正文内容防止溢出 */
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 用途：让帖子正文里的 1. 这类序号在浅色/深色模式下使用指定蓝色并加粗 */
.post-list-marker,
.post-body ol::marker {
    color: var(--post-list-marker);
    font-weight: bold;
}

/* 用途：在移动端触摸或鼠标长按卡片时的灰色背景反馈 */
.card:active {
    background-color: rgba(150, 150, 150, 0.05);
}

/* 用途：超过 200 字被截断时，末尾追加的“点击以查看全文”链接文字样式 */
.read-more {
    color: var(--read-more);
    font-weight: bold;
    margin-left: 5px;
}

/* 用途：给 NSFW 内容的文本施加高斯模糊滤镜，防止路人偷窥 */
.blur-content {
    filter: blur(3.5px);
    user-select: none;
    transition: filter 0.3s ease;
}

/* 用途：取消模糊滤镜，恢复文本的正常显示状态和可选状态 */
.revealed-content {
    filter: blur(0);
    user-select: auto;
}

/* 用途：特化展示NSFW标签，使用醒目的橙色、加粗字体和下划线提醒用户 */
.nsfw-keyword {
    color: var(--nsfw-color) !important;
    font-weight: 900 !important;
    font-size: 1.2em !important;
    text-decoration: underline 1px solid var(--nsfw-color) !important;
    cursor: pointer;
}

/* 用途：特化展示疑似搬运标签，使用主题自适应的绿色并加粗 */
.repost-keyword {
    color: var(--repost-color) !important;
    font-weight: bold !important;
}

/* 用途：帖子卡片底部的信息栏布局，利用Flexbox让投票和作者信息水平排列 */
.post-footer {
    display: flex;
    align-items: center;
    gap: 8.5px;
    /* 为了适应新的胶囊外边距，微调了整体间距 */
    margin-top: 12px;
    flex-wrap: wrap;
}

/* 用途：卡片底部的作者、等级徽章、发布时间等元数据的字体微调 */
.post-meta {
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* 用途：包裹赞和踩按钮的统一胶囊型灰色背景框。按照要求，点赞胶囊比用户名的外边距(4px)大2.5px，即6.5px */
.vote-pill {
    display: flex;
    align-items: center;
    background-color: var(--vote-bg-neutral);
    border-radius: 20px;
    padding: 2px;
    transition: background-color 0.3s ease;
    height: fit-content;
    gap: 2px;
    margin-right: 6.5px;
    /* 点赞胶囊比用户名的外边距大2.5px */
}

/* 用途：独立的赞和踩透明按钮的尺寸（已缩小尺寸）、圆角和排版设置 */
.like-btn,
.dislike-btn {
    background: transparent;
    color: white;
    border: none;
    padding: 2px 6px;
    /* 缩小了内边距 */
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    /* 缩小了字号 */
    border-radius: 12px;
    transition: all 0.2s;
}

/* 用途：胶囊框里赞和踩两个按钮中间的半透明竖向分割线 */
.vote-divider {
    width: 1px;
    height: 14px;
    /* 适配缩小后的按钮高度 */
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 2px;
    transition: opacity 0.2s;
}

/* 用途：点击赞或踩时放大 1.1 倍，恢复旧版点击反馈。 */
.like-btn:active,
.dislike-btn:active {
    transform: scale(1.1);
}

/* 用途：用户点赞后，顶按钮区域背景变红的交互反馈 */
.vote-pill.is-liked .like-btn {
    background-color: var(--brand);
}

/* 用途：用户点踩后，踩按钮区域背景变蓝的交互反馈 */
.vote-pill.is-disliked .dislike-btn {
    background-color: var(--vote-bg-disliked);
}

/* 用途：当用户点赞或踩后，降低中间分割线的可见度，让色块更融合 */
.vote-pill.is-liked .vote-divider,
.vote-pill.is-disliked .vote-divider {
    opacity: 0.2;
}

/* 用途：用户名的悬停效果，鼠标移上去显示下划线并且字体加粗，用于跳转主页的暗示 */
.author-link {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.author-link:hover {
    text-decoration: underline;
    font-weight: 900 !important;
    /* 悬停时加粗 */
}

/* 用途：所有用户等级小徽章（如“原木”）的统一样式基类 */
.lv-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    display: inline-block;
}

.mod-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
    color: white;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.28);
    display: inline-block;
}

/* 用途：定义等级“原木”的专属配色 */
.lv-log {
    background: #a1662f;
}

/* 用途：定义等级“黑铁”的专属配色 */
.lv-iron {
    background: #555555;
}

/* 用途：定义等级“青铜”的专属配色 */
.lv-bronze {
    background: #cd7f32;
}

/* 用途：定义等级“白银”的专属配色及消除文字阴影 */
.lv-silver {
    background: #e0e0e0;
    color: #000;
    text-shadow: none;
}

/* 用途：定义等级“黄金”的专属配色 */
.lv-gold {
    background: #ffd700;
    color: black;
    text-shadow: none;
}

/* 用途：定义等级“钻石”的专属配色 */
.lv-diamond {
    background: #add8e6;
    color: #0000ff;
    text-shadow: none;
}

/* 用途：定义等级“王者”的渐变配色 */
.lv-king {
    background: linear-gradient(45deg, #ffd700, #ffaa00);
    color: #fff;
    padding-right: 18px;
    text-shadow: none;
}

/* 用途：在王者徽章右侧添加一个绝对定位的斜体 V 字装饰 */
.lv-king::after {
    content: "V";
    position: absolute;
    right: 4px;
    font-style: italic;
    font-weight: 900;
}

/* 用途：定义等级“史诗”的高级紫渐变配色并添加外发光特效 */
.lv-epic {
    background: linear-gradient(45deg, #a333c8, #6d28d9);
    color: white;
    padding-right: 18px;
    box-shadow: 0 0 5px rgba(255, 0, 204, 0.5);
}

/* 用途：在史诗徽章右侧同样添加斜体 V 字装饰 */
.lv-epic::after {
    content: "V";
    position: absolute;
    right: 4px;
    font-style: italic;
    font-weight: 900;
}

/* 用途：包裹帖子所有关键词的文本容器，定义整体颜色 and 边距 */
.kw-display {
    display: block;
    margin-top: 5px;
    margin-bottom: 5px;
    color: var(--kw-text);
    font-weight: bold;
    font-size: 0.9em;
}

/* 用途：触底无限加载动画的外部容器，默认透明隐藏 */
.loading-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

/* 用途：当请求数据时，配合JS脚本将加载容器的透明度设为可见 */
.loading-sentinel.visible {
    opacity: 1;
}

/* 用途：渲染加载动画内部的单个小圆点，并绑定无限跳动动画 */
.loading-sentinel span {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 5px;
    background: var(--brand);
    border-radius: 50%;
    animation: bounce 0.4s infinite alternate;
}

/* 用途：设置加载动画第二个圆点的起跳延迟，形成波浪感 */
.loading-sentinel span:nth-child(2) {
    animation-delay: 0.2s;
}

/* 用途：设置加载动画第三个圆点的起跳延迟，完善波浪感 */
.loading-sentinel span:nth-child(3) {
    animation-delay: 0.4s;
}

/* 用途：声明加载圆点沿Y轴上下位移的关键帧动画 */
@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

/* 用途：当全部帖子加载完毕后，底部的结束提示语的排版样式 */
.end-message {
    text-align: center;
    color: #999;
    font-size: 0.9em;
    padding: 20px;
    display: none;
}
