Files
stash/stash-web/src/App.css
T
stash 95b6cedb06 fix(web): 搜索框聚焦双框与滚动条
- 组件库 Input:聚焦只用边框变主色,不再叠加 outline(文本框点击也会命中 :focus-visible)
- 页面全局 :focus-visible 收窄到非表单控件,避免覆盖输入框自身的 outline 处理
- 搜索框恢复旧版浅边框 + 卡片阴影,聚焦不追加边框/焦点环
- Layout 新增 hideScrollbar,内容区滚动条隐藏(旧版行为)
2026-10-28 20:29:36 +08:00

667 lines
12 KiB
CSS

/* 页面级样式:只保留「组件库没有」的部分(背景、外壳、封面兜底、正文版式)。
颜色 / 间距 / 字号全部取自 @stash/ui 的令牌。 */
.app {
position: relative;
z-index: 1;
/* 透明:让固定背景图从下面透出来(Layout 默认有底色) */
background-color: transparent;
/* 旧版阴影是 2% / 6%,比库默认更深,属于主题级覆盖 */
--su-shadow-card: 0 6px 16px rgba(27, 26, 49, 0.02);
--su-shadow-hover: 0 6px 16px rgba(27, 26, 49, 0.06);
}
/* 顶部背景图:固定 65vh,底部渐隐到页面底色 */
.site-background {
position: fixed;
inset: 0 0 auto;
z-index: 0;
height: 65vh;
background: url('./assets/site-bg.jpg') center top / cover no-repeat;
pointer-events: none;
}
.site-background::after {
content: '';
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 80%;
background: linear-gradient(to bottom, transparent, var(--su-bg-page));
}
/* ---------- 页头 ---------- */
.site-header-inner {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--su-space-4);
width: 100%;
max-width: var(--su-layout-width);
height: calc(var(--su-header-height) - 1px);
margin: 0 auto;
padding: 0 var(--su-space-5);
}
.site-brand {
display: flex;
align-items: center;
gap: var(--su-space-2);
}
.site-brand-mark {
display: grid;
place-items: center;
width: 32px;
height: 32px;
border-radius: var(--su-radius-pill);
background-color: var(--su-text-main);
color: var(--su-white);
font-size: var(--su-font-size-base);
font-weight: var(--su-font-weight-strong);
}
.site-brand-name {
font-size: var(--su-font-size-lg);
line-height: var(--su-line-height-lg);
letter-spacing: 0.04em;
}
.header-info {
flex: 1;
justify-content: center;
}
.header-actions {
margin-left: auto;
}
/* ---------- 搜索:悬浮在页头下方居中 ---------- */
.search-row {
position: fixed;
top: 76px;
left: 50%;
z-index: var(--su-z-header);
width: min(480px, calc(100vw - 48px));
height: 44px;
transform: translateX(-50%);
}
/* 旧版搜索是「浅边框 + 卡片阴影」,聚焦时不额外加边框/焦点环 */
.search-row > *:first-child,
.search-row > *:first-child:focus-within {
border-color: var(--su-border);
box-shadow: var(--su-shadow-card);
}
/* ---------- 两栏骨架 ---------- */
.content {
display: flex;
flex-direction: column;
gap: var(--su-space-5);
padding-bottom: var(--su-space-10);
}
.sidebar {
display: flex;
flex-direction: column;
gap: var(--su-space-4);
padding-top: 88px;
}
/* ---------- 侧栏卡片 ---------- */
.profile-card {
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
padding: 18px 14px 14px;
text-align: center;
}
.profile-name {
line-height: 1.2;
}
.profile-role {
padding: 1px 8px;
border: 1px solid var(--su-border);
border-radius: var(--su-radius-pill);
font-size: var(--su-font-size-xs);
line-height: 18px;
color: var(--su-text-sub);
}
.profile-bio {
margin-top: 2px;
line-height: 1.55;
}
.profile-location {
margin-top: 2px;
font-size: var(--su-font-size-xs);
line-height: 18px;
color: var(--su-text-muted);
}
/* 旧版头像下面留 4px,和名字之间更松 */
.profile-card > span:first-child {
margin-bottom: 4px;
}
.service-panel {
padding: 12px 14px;
}
/* 旧版标题与统计值的行高比库默认更紧 */
.service-panel h2 {
line-height: 20px;
}
/* 旧版连接状态药丸:22 高、12px */
.service-status {
height: 22px;
padding: 0 10px;
font-size: var(--su-font-size-xs);
}
/* 旧版统计行是 12/18 */
.service-stats span {
line-height: 18px;
}
.service-stats {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 10px;
}
.service-actions {
display: flex;
gap: var(--su-space-2);
margin-top: var(--su-space-3);
}
.service-actions > * {
flex: 1;
}
.service-host {
max-width: 140px;
}
.nav-card {
padding: var(--su-space-2);
}
/* ---------- 首页分区 ---------- */
.home-view {
display: flex;
flex-direction: column;
gap: var(--su-space-5);
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--su-space-4);
}
/* 旧版分区标题是 16/1.2,更多按钮是 24px 小方按钮 */
.section-header h2 {
line-height: 1.2;
}
.section-more {
width: 24px;
height: 24px;
}
.section-bar {
width: 4px;
height: 16px;
border-radius: var(--su-radius-pill);
}
/* ---------- 应用条目 ---------- */
.app-card {
display: flex;
align-items: center;
gap: 15px;
padding: 6px 0;
border-radius: var(--su-radius-sm);
}
.app-card:hover .app-card-name {
color: var(--su-color-primary);
}
.app-card-info {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
/* 旧版应用头像是 48px 圆形,右下角是 10px 小认证标 */
.app-card-avatar {
width: 48px;
height: 48px;
font-size: 18px;
}
.app-card-avatar > span + span {
width: 10px;
height: 10px;
border-width: 1px;
font-size: 6px;
}
/* ---------- 图文白卡 ---------- */
.ces-card {
overflow: hidden;
transition: transform var(--su-duration-fast) var(--su-ease-in-out);
}
.ces-card:hover {
transform: translateY(-2px);
}
.ces-body {
display: flex;
flex-direction: column;
gap: var(--su-space-1);
padding: var(--su-space-3);
text-align: left;
}
.ces-body--button {
width: 100%;
cursor: pointer;
}
.ces-body--button:hover {
background-color: var(--su-bg-subtle);
}
/* ---------- 详情 ---------- */
.detail-view {
display: flex;
flex-direction: column;
gap: var(--su-space-5);
}
.detail-nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px var(--su-space-5);
}
.detail-back {
color: var(--su-color-primary);
font-size: var(--su-font-size-md);
font-weight: var(--su-font-weight-bold);
cursor: pointer;
}
.detail-back:hover {
text-decoration: underline;
}
.detail-nav > * {
width: 100%;
}
.detail-hero {
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 0 4px;
text-align: center;
}
.detail-hero-icon {
font-size: 40px;
line-height: 1;
}
.item-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 24px 28px;
}
.item-title {
justify-content: center;
gap: 6px;
}
.item-edit {
margin-left: var(--su-space-1);
font-size: var(--su-font-size-sm);
color: var(--su-color-primary);
vertical-align: middle;
cursor: pointer;
}
.item-edit:disabled {
cursor: not-allowed;
opacity: 0.6;
}
.item-cover {
display: grid;
place-items: center;
width: 120px;
margin: var(--su-space-4) 0;
overflow: hidden;
border-radius: var(--su-radius-md);
background-color: var(--su-bg-light);
}
.item-cover--square {
aspect-ratio: 1;
}
.item-cover--portrait {
width: 160px;
aspect-ratio: 2 / 3;
}
.item-cover img {
width: 100%;
height: 100%;
object-fit: cover;
}
.item-cover-letter {
font-size: 32px;
color: var(--su-text-sub);
}
.item-quote {
display: flex;
gap: 6px;
width: 100%;
margin-top: 18px;
text-align: left;
}
.item-quote-mark {
font-size: var(--su-font-size-lg);
line-height: 1;
color: var(--su-color-primary);
}
.item-quote-text {
font-size: var(--su-font-size-md);
line-height: 1.7;
color: var(--su-text-sub);
}
.item-actions {
display: flex;
align-items: center;
gap: var(--su-space-2);
width: 100%;
margin-top: 18px;
}
/* 统计小药丸:浏览 / 点赞的底 */
.item-stat {
min-width: 56px;
height: 36px;
padding: 0 var(--su-space-3);
border-radius: var(--su-radius-cover);
background-color: var(--su-bg-page);
}
/* 跳转按钮占满剩余宽度 */
.item-jump {
display: inline-flex;
flex: 1;
align-items: center;
justify-content: center;
gap: 6px;
height: 36px;
border-radius: var(--su-radius-cover);
background-color: var(--su-color-primary);
color: var(--su-white);
font-size: var(--su-font-size-md);
transition: opacity var(--su-duration-fast) var(--su-ease-in-out);
}
.item-jump:hover:not(:disabled) {
background-color: var(--su-color-primary-hover);
}
.item-jump:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.item-banner {
width: 100%;
margin-top: var(--su-space-4);
border-radius: var(--su-radius-md);
}
/* ---------- 文章 ---------- */
.article-head {
display: flex;
flex-direction: column;
gap: var(--su-space-2);
}
.article-heading {
max-width: 760px;
font-size: var(--su-font-size-xl);
font-weight: var(--su-font-weight-strong);
line-height: 1.4;
}
.article-meta-dot {
color: var(--su-text-muted);
}
.article-body-card {
overflow: hidden;
}
.article-body {
display: flex;
flex-direction: column;
gap: var(--su-space-3);
padding: 32px 40px 40px;
}
.article-lead {
margin-bottom: var(--su-space-2);
}
.article-body-image {
width: 100%;
margin: var(--su-space-2) 0;
border-radius: var(--su-radius-md);
}
/* ---------- 推荐阅读 ---------- */
.related-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px 24px;
margin-top: var(--su-space-4);
}
.related-title {
display: flex;
align-items: center;
gap: var(--su-space-2);
margin-bottom: var(--su-space-4);
}
.related-item {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 4px;
border-radius: var(--su-radius-cover);
text-align: left;
transition: background-color var(--su-duration-fast) var(--su-ease-in-out);
}
.related-item:hover {
background-color: var(--su-bg-subtle);
}
.related-info {
min-width: 0;
}
/* ---------- 通用 ---------- */
/* 服务面板的两个操作按钮:旧版是 12px / 28 高 / 等分 / 描边 */
.service-action {
flex: 1;
height: 28px;
padding: 0 var(--su-space-2);
font-size: var(--su-font-size-xs);
border-radius: var(--su-radius-cover);
}
.service-action:hover:not(:disabled) {
border-color: var(--su-color-primary);
background-color: var(--su-color-primary-soft);
color: var(--su-color-primary);
}
/* 页头图标按钮:旧版 hover 是浅灰底 + 深色字 */
.site-header-inner button:hover {
background-color: var(--su-bg-light);
color: var(--su-text-main);
}
/* 分区卡右上角 •••:旧版 hover 只有浅灰底 */
.section-more:hover {
background-color: var(--su-bg-light);
color: var(--su-text-sub);
}
/* 详情 / 文章切换时的淡入上浮(旧版 view-in) */
@keyframes view-in {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: none;
}
}
.detail-view {
animation: view-in 0.22s ease both;
}
@media (prefers-reduced-motion: reduce) {
.detail-view {
animation: none;
}
}
.link-button {
display: inline-flex;
align-items: center;
gap: var(--su-space-1);
height: 32px;
padding: 0 var(--su-space-3);
border: 1px solid var(--su-border);
border-radius: var(--su-radius-sm);
font-size: var(--su-font-size-sm);
color: var(--su-text-sub);
transition: background-color var(--su-duration-fast) var(--su-ease-in-out);
}
.link-button:hover {
background-color: var(--su-bg-subtle);
color: var(--su-text-main);
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
.sidebar {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--su-space-3);
padding: 0 var(--su-space-4) var(--su-space-4);
}
.profile-card {
grid-row: span 2;
}
.service-panel {
display: none;
}
.header-info {
display: none;
}
.search-row {
position: static;
width: 100%;
height: 36px;
transform: none;
}
.content {
padding-top: var(--su-space-4);
}
}
@media (max-width: 820px) {
.sidebar {
display: none;
}
.site-header-inner {
height: 56px;
}
}
@media (prefers-reduced-motion: reduce) {
.app-card,
.related-item,
.link-button {
transition: none;
}
}