Download static/css/base.css from Elvis85/bookrank: direct link, hf CLI and curl.
- Browser
- Download file 34.4 kB
-
https://huggingface.co/spaces/Elvis85/bookrank/resolve/main/static/css/base.css
- Command line
-
hf download hf://spaces/Elvis85/bookrank/static/css/base.css
-
curl -L -o base.css https://huggingface.co/spaces/Elvis85/bookrank/resolve/main/static/css/base.css
34.4 kB
/* BookRank Base Styles - Professional Business Theme with Full Dark Mode Support */
/* CSS Custom Properties - Vercel Design System Tokens */
:root {
/* Primary Colors - Vercel Black & White */
--primary-color: #171717;
--primary-light: #fafafa;
--primary-dark: #000000;
--primary-gradient: linear-gradient(135deg, #171717 0%, #000000 100%);
/* Vercel Color Palette */
--black: #171717;
--white: #ffffff;
--gray-50: #fafafa;
--gray-100: #ebebeb;
--gray-400: #808080;
--gray-500: #666666;
--gray-600: #4d4d4d;
/* WCAG AA 修正(第二轮实测):#0072f5 作正文/链接色时白底 4.44:1、
--gray-50(#fafafa) 底 4.26:1,均低于 4.5:1。
#006ee8 是**刚好达标的最浅值**(白底 4.78:1、#fafafa 底 4.58:1),
色相与观感尽量贴近原色,把设计改动压到最小。 */
--link-blue: #006ee8;
--focus-blue: hsl(212,100%,48%);
--ship-red: #ff5b4f;
--preview-pink: #de1d8d;
--develop-blue: #0a72ef;
--console-blue: #0070f3;
--console-purple: #7928ca;
--console-pink: #eb367f;
--badge-bg: #ebf5ff;
--badge-text: #0068d6;
/* Background Colors - Light Mode */
--bg-primary: var(--white);
--bg-secondary: var(--gray-50);
--bg-tertiary: var(--gray-100);
--bg-light: var(--white);
--bg-white: var(--white);
--bg-card: var(--white);
--card-bg: var(--white);
/* Text Colors - Light Mode */
--text-primary: var(--black);
--text-secondary: var(--gray-600);
--text-light: var(--gray-500);
--text-white: var(--white);
/* WCAG AA 修正(dsh-design-audit 实测):--gray-400(#808080) 作正文色时
白底仅 3.95:1、--gray-50(#fafafa) 底仅 3.78:1,均低于正文所需的 4.5:1。
这里改为专用文字色 #707070(白底 4.95:1、#fafafa 底 4.75:1)。
注意:不改 --gray-400 本身 —— 它还被 --accent-silver 渐变引用,
改调色板会连带动到非文字用途。 */
--text-muted: #707070;
--text-gold: #b8860b;
/* Border Colors */
--border-color: var(--gray-100);
--border-light: var(--gray-50);
/* Warning state (search/load failure banners) - light */
--state-warning-border: #d6a94f;
--state-warning-tint: #fdf6ec;
/* Accent Colors - Vercel Workflow Colors */
--accent-silver: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-600) 100%);
--accent-bronze: linear-gradient(135deg, var(--console-purple) 0%, var(--console-pink) 100%);
--accent-gold: linear-gradient(135deg, var(--develop-blue) 0%, var(--console-blue) 100%);
--accent-red: var(--ship-red);
--accent-green: #10b981;
--accent-blue: var(--link-blue);
--accent-purple: var(--console-purple);
/* Shadows - Vercel Style */
--shadow-ring: rgba(0,0,0,0.08) 0px 0px 0px 1px;
--shadow-ring-light: rgb(235,235,235) 0px 0px 0px 1px;
--shadow-subtle: rgba(0,0,0,0.04) 0px 2px 2px 0px;
--shadow-sm: var(--shadow-ring-light);
--shadow-md: var(--shadow-card);
--shadow-lg: var(--shadow-card-full);
--shadow-xl: var(--shadow-card-full);
--shadow-hover: var(--shadow-card-full);
--shadow-card: rgba(0,0,0,0.08) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 2px 0px, rgb(250,250,250) 0px 0px 0px 1px;
--shadow-card-full: rgba(0,0,0,0.08) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 2px 0px, rgba(0,0,0,0.04) 0px 8px 8px -8px, rgb(250,250,250) 0px 0px 0px 1px;
/* Spacing - Vercel Scale */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 2.5rem;
/* Border Radius - Vercel Scale */
--radius-sm: 2px;
--radius-md: 4px;
--radius-lg: 6px;
--radius-xl: 8px;
--radius-full: 9999px;
/* Transitions - Smooth and natural */
--transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
--transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
--transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
/* Fonts - Vercel Style */
--font-sans: 'Geist', system-ui, -apple-system, Arial, sans-serif;
--font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, 'Roboto Mono', Menlo, monospace;
/* Layout */
--sidebar-width: 260px;
--top-nav-height: 64px;
}
/* Dark Theme - System Preference + Manual Toggle */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--primary-color: #ff6b35;
--primary-light: rgba(255, 107, 53, 0.15);
--primary-dark: #e55a2b;
--primary-gradient: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
--white: #1a1d22;
--badge-bg: #1b2531;
--badge-text: #7fb2ff;
/* 三层背景深度:页面最深 → 侧边栏中等 → 卡片最亮(中性炭灰,无蓝调) */
--bg-primary: #0f1115;
--bg-secondary: #14161a;
--bg-tertiary: #1a1d22;
--bg-light: #0f1115;
--bg-white: #14161a;
--bg-card: #14161a;
--card-bg: #1a1d22;
/* 文字层级:主/次/弱 */
--text-primary: #e9ebee;
--text-secondary: #a9aeb8;
--text-light: #a9aeb8;
--text-muted: #71767f;
--text-gold: #f7c948;
/* 边框:强(结构线)/ 弱(次级分隔) */
--border-color: #262a31;
--border-light: #1f2228;
/* 警告态(搜索/加载失败横幅)- 暗色 */
--state-warning-border: #8a6d2f;
--state-warning-tint: #1c1a14;
/* 暗色下重模糊阴影发糊,改用细描边环 */
--shadow-ring: 0 0 0 1px var(--border-color);
--shadow-ring-light: 0 0 0 1px var(--border-light);
--shadow-sm: 0 0 0 1px var(--border-color);
--shadow-md: 0 0 0 1px var(--border-color);
--shadow-lg: 0 0 0 1px var(--border-color);
--shadow-card: 0 0 0 1px var(--border-color);
--shadow-card-full: 0 0 0 1px var(--border-color);
}
}
/* Manual Dark Theme Override */
[data-theme="dark"] {
--primary-color: #ff6b35;
--primary-light: rgba(255, 107, 53, 0.15);
--primary-dark: #e55a2b;
--primary-gradient: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
--white: #1a1d22;
--badge-bg: #1b2531;
--badge-text: #7fb2ff;
/* 三层背景深度:页面最深 → 侧边栏中等 → 卡片最亮(中性炭灰,无蓝调) */
--bg-primary: #0f1115;
--bg-secondary: #14161a;
--bg-tertiary: #1a1d22;
--bg-light: #0f1115;
--bg-white: #14161a;
--bg-card: #14161a;
--card-bg: #1a1d22;
/* 文字层级:主/次/弱 */
--text-primary: #e9ebee;
--text-secondary: #a9aeb8;
--text-light: #a9aeb8;
--text-muted: #71767f;
--text-gold: #f7c948;
/* 边框:强(结构线)/ 弱(次级分隔) */
--border-color: #262a31;
--border-light: #1f2228;
/* 警告态(搜索/加载失败横幅)- 暗色 */
--state-warning-border: #8a6d2f;
--state-warning-tint: #1c1a14;
/* 暗色下重模糊阴影发糊,改用细描边环 */
--shadow-ring: 0 0 0 1px var(--border-color);
--shadow-ring-light: 0 0 0 1px var(--border-light);
--shadow-sm: 0 0 0 1px var(--border-color);
--shadow-md: 0 0 0 1px var(--border-color);
--shadow-lg: 0 0 0 1px var(--border-color);
--shadow-card: 0 0 0 1px var(--border-color);
--shadow-card-full: 0 0 0 1px var(--border-color);
}
/* Reset & Base */
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 16px;
scroll-behavior: smooth;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: var(--font-sans);
font-size: 1rem;
line-height: 1.5;
color: var(--text-primary);
background-color: var(--bg-light);
min-height: 100vh;
font-feature-settings: "liga" 1;
-webkit-font-smoothing: antialiased;
contain: layout style;
}
/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
html { scroll-behavior: auto; }
}
/* Links */
a {
text-decoration: none;
color: inherit;
transition: color var(--transition-fast);
}
/* Buttons */
button {
border: none;
background: none;
cursor: pointer;
font-family: inherit;
}
/* Images */
img {
max-width: 100%;
height: auto;
display: block;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
line-height: 1.3;
color: var(--text-primary);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
/* Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-gold { color: var(--text-gold); }
.text-white { color: var(--text-white); }
/* Layout */
.app-container {
display: flex;
min-height: 100vh;
}
.main-content {
flex: 1;
margin-left: var(--sidebar-width);
padding: var(--spacing-lg);
padding-top: calc(var(--top-nav-height) + var(--spacing-lg));
transition: margin-left var(--transition-normal);
background-color: var(--bg-light);
}
/* 平板端 & 手机端:侧边栏不固定,主内容区占满 */
@media (max-width: 1199px) {
.main-content {
margin-left: 0;
padding: var(--spacing-md);
padding-top: calc(var(--top-nav-height) + var(--spacing-md));
}
}
/* Top Navigation - Vercel Style */
.top-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
height: var(--top-nav-height);
background: var(--bg-card);
backdrop-filter: blur(12px);
box-shadow: var(--shadow-ring);
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
padding: 0 var(--spacing-lg);
z-index: 1000;
transition: background-color var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}
.nav-brand {
display: flex;
align-items: center;
gap: var(--spacing-sm);
/* WCAG 2.5.8:实测命中区 91.38×21px,高度低于 24px 下限 */
min-height: 24px;
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.28px;
}
.nav-brand svg {
color: var(--primary-color);
}
.nav-links {
display: flex;
align-items: center;
gap: 8px;
margin-left: var(--spacing-lg);
list-style: none;
}
/* 导航项:统一 36px 高度节奏(图标 16px + 6px 间距 + 13px 标签) */
.nav-link {
display: flex;
align-items: center;
gap: 6px;
height: 36px;
padding: 0 10px;
border-radius: 4px;
transition: background-color var(--transition-fast), border-color var(--transition-fast);
color: var(--text-secondary);
font-size: 13px;
font-weight: 500;
text-decoration: none;
}
.nav-link svg {
width: 16px;
height: 16px;
}
/* 悬停:仅底色变化,不下划线、不跳色(颜色保持 --text-secondary) */
.nav-link:hover,
.nav-link:focus {
background-color: var(--bg-tertiary);
}
/* 当前页:模板输出 .active 类 + aria-current="page"(两者同选,避免新增类) */
.nav-link.active,
.nav-link[aria-current="page"] {
color: var(--text-primary);
background-color: var(--bg-tertiary);
font-weight: 600;
}
.nav-link:focus-visible {
outline: 2px solid var(--focus-blue);
outline-offset: 2px;
}
.nav-actions {
margin-left: auto;
display: flex;
justify-content: flex-end;
gap: 8px;
align-items: center;
}
/* Language Switcher - Globe Dropdown */
.language-switcher {
position: relative;
display: flex;
align-items: center;
}
/* 语言切换按钮:与主题按钮同尺寸同描边(36px / radius 4px / 透明底) */
.lang-globe-btn {
display: flex;
align-items: center;
gap: 6px;
height: 36px;
padding: 0 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.lang-globe-btn:hover,
.lang-globe-btn:focus {
border-color: var(--text-muted);
background: transparent;
color: var(--text-primary);
}
.lang-globe-btn .icon {
width: 16px;
height: 16px;
}
.lang-current {
font-size: 0.75rem;
min-width: 16px;
text-align: center;
}
.lang-dropdown {
position: absolute;
top: calc(100% + 6px);
right: 0;
min-width: 180px;
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
padding: 6px;
z-index: 1000;
opacity: 0;
visibility: hidden;
transform: translateY(-4px);
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.lang-dropdown.open {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.lang-option {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 8px 10px;
border: none;
border-radius: var(--radius-md);
background: transparent;
color: var(--text-primary);
font-size: 0.875rem;
cursor: pointer;
transition: background 0.15s ease;
text-align: left;
}
.lang-option:hover {
background: var(--bg-tertiary);
}
.lang-option.active {
background: var(--badge-bg);
color: var(--badge-text);
}
.lang-option.active .lang-check {
opacity: 1;
}
.lang-flag {
font-size: 0.75rem;
font-weight: 600;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-tertiary);
border-radius: var(--radius-md);
color: var(--text-secondary);
flex-shrink: 0;
}
.lang-name {
flex: 1;
font-weight: 500;
}
.lang-check {
width: 16px;
height: 16px;
opacity: 0;
color: var(--badge-text);
transition: opacity 0.15s ease;
}
.lang-divider-line {
height: 1px;
background: var(--border-color);
margin: 6px 0;
}
.lang-coming-soon {
padding: 6px 10px;
font-size: 0.75rem;
color: var(--text-muted);
text-align: center;
}
/* Backward compatibility: old lang-btn style */
.lang-btn {
padding: var(--spacing-xs) var(--spacing-sm);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
background: var(--bg-card);
color: var(--text-secondary);
font-size: 0.8125rem;
font-weight: 600;
cursor: pointer;
transition: var(--transition-normal);
}
.lang-btn.active {
background: var(--badge-bg);
color: var(--badge-text);
border-color: var(--badge-text);
}
.lang-divider {
color: var(--text-muted);
margin: 0 2px;
}
.nav-cta {
display: inline-block;
background: var(--primary-color);
color: var(--text-white);
padding: 8px 16px;
border-radius: var(--radius-lg);
font-size: 14px;
font-weight: 500;
text-decoration: none;
transition: opacity var(--transition-fast);
}
.nav-cta:hover {
opacity: 0.85;
}
/* Sidebar - Vercel Style */
.sidebar {
position: fixed;
left: 0;
top: var(--top-nav-height);
bottom: 0;
width: var(--sidebar-width);
background-color: var(--bg-white);
box-shadow: var(--shadow-ring);
padding: var(--spacing-lg);
overflow-y: auto;
transition: transform var(--transition-normal), background-color var(--transition-normal);
z-index: 999;
}
.sidebar.open { transform: translateX(0); }
/* 平板端 & 手机端:侧边栏默认隐藏,可通过按钮切换 */
@media (max-width: 1199px) {
.sidebar {
transform: translateX(-100%);
width: 80vw;
max-width: 300px;
}
/* 侧边栏展开时添加遮罩层 */
.sidebar.open::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: -1;
pointer-events: auto;
}
}
.sidebar-section { margin-bottom: var(--spacing-xl); }
.sidebar-title {
font-family: var(--font-mono);
font-size: 12px;
font-weight: 500;
color: var(--text-muted);
text-transform: uppercase;
margin-bottom: var(--spacing-md);
letter-spacing: 0.5px;
}
.sidebar-menu { list-style: none; }
.sidebar-item { margin-bottom: var(--spacing-xs); }
.sidebar-link {
display: flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-lg);
transition: all var(--transition-fast);
color: var(--text-secondary);
font-size: 14px;
font-weight: 500;
text-decoration: none;
}
.sidebar-link:hover,
.sidebar-link:focus {
background-color: var(--bg-tertiary);
color: var(--text-primary);
}
.sidebar-link.active {
background-color: var(--bg-tertiary);
color: var(--text-primary);
}
.sidebar-link:focus-visible {
outline: 2px solid var(--focus-blue);
outline-offset: 2px;
}
.sidebar-link svg {
width: 18px;
height: 18px;
}
/* Sidebar Toggle - Vercel Style */
.sidebar-toggle {
position: fixed;
left: var(--spacing-lg);
top: calc(var(--top-nav-height) + var(--spacing-md));
z-index: 998;
background-color: var(--bg-white);
border: none;
border-radius: var(--radius-lg);
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-ring-light);
transition: all var(--transition-fast);
}
.sidebar-toggle:hover,
.sidebar-toggle:focus {
background-color: var(--bg-tertiary);
box-shadow: var(--shadow-ring);
}
.sidebar-toggle:focus-visible {
outline: 2px solid var(--focus-blue);
outline-offset: 2px;
}
/* 桌面端(≥1200px)隐藏侧边栏切换按钮,侧边栏始终可见 */
@media (min-width: 1200px) { .sidebar-toggle { display: none; } }
/* ============================================
* 平板端导航优化 (768px-1199px)
* ============================================ */
@media (min-width: 768px) and (max-width: 1199px) {
.top-nav {
padding: 0 var(--spacing-md);
}
/* 间距节奏保持全站一致(8px),仅收窄内边距与字号以适配窄屏 */
.nav-link {
padding: 0 8px;
font-size: 13px;
}
.nav-link span {
display: inline;
}
}
/* ============================================
* 手机端导航栏优化 (≤767px)
* ============================================ */
@media (max-width: 767px) {
:root {
/* 修复(dsh-design-audit 实测):原值为 `auto`。而 --top-nav-height 被用于
`calc(var(--top-nav-height) + …)`(.sidebar-toggle 的 top、主内容 padding-top 等)——
把长度变量设成 auto 会让整个 calc() **非法**,声明被浏览器丢弃,于是
.sidebar-toggle 的 top 退回 auto,position:fixed 的按钮落到 y≈0 的导航条区域内,
被 z-index 1000 的 .top-nav 完全覆盖(实测 6 个采样点全部命中导航/品牌文字,
用户点不到侧栏开关)。取值与下方 .top-nav 的 min-height 保持一致。 */
--top-nav-height: 56px;
}
.top-nav {
height: auto;
min-height: 56px;
padding: var(--spacing-xs) var(--spacing-sm);
flex-wrap: wrap;
gap: var(--spacing-xs);
}
.nav-brand {
font-size: 1rem;
order: 1;
flex-shrink: 0;
}
.nav-brand svg {
width: 22px;
height: 22px;
}
.nav-links {
order: 3;
width: 100%;
margin-left: 0;
margin-top: var(--spacing-xs);
gap: var(--spacing-xs);
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
-ms-overflow-style: none;
padding-bottom: var(--spacing-xs);
flex-wrap: nowrap;
}
.nav-links::-webkit-scrollbar {
display: none;
}
/* 移动端仍是横向滚动条:胶囊外观 + 36px 触控高度(保留原有 0.8rem 字号) */
.nav-link {
padding: 0 var(--spacing-sm);
font-size: 0.8rem;
white-space: nowrap;
flex-shrink: 0;
border-radius: var(--radius-full);
}
.nav-link span {
display: none;
}
.nav-link svg {
width: 20px;
height: 20px;
}
.nav-actions {
order: 2;
margin-left: auto;
gap: var(--spacing-xs);
flex-shrink: 0;
}
.language-switcher {
font-size: 0.75rem;
}
/* 尺寸由 .top-nav .lang-globe-btn 统一(窄屏 44px 产品目标触控高度);此处只降字号 */
.lang-globe-btn {
font-size: 0.75rem;
}
.lang-btn {
padding: var(--spacing-xs) var(--spacing-sm);
font-size: 0.75rem;
min-width: 32px;
min-height: 32px;
}
/* 主题按钮尺寸同样由 .top-nav .btn-icon#theme-toggle 统一(窄屏 44px 产品目标触控高度) */
.main-content {
padding-top: calc(70px + var(--spacing-sm));
}
}
@media (max-width: 480px) {
.top-nav {
padding: var(--spacing-xs) var(--spacing-xs);
gap: 2px;
}
.nav-brand {
font-size: 0.9rem;
gap: 2px;
}
.nav-brand svg {
width: 18px;
height: 18px;
}
.nav-link svg {
width: 16px;
height: 16px;
}
/* 尺寸统一由下表 .top-nav 规则接管(窄屏 44px 产品目标 / radius 4px / 边框),此处只降字号 */
.lang-globe-btn {
font-size: 0.7rem;
}
.lang-globe-btn .icon {
width: 16px;
height: 16px;
}
.lang-btn {
font-size: 0.7rem;
padding: 2px 6px;
}
}
/* ============================================
* 窄屏全局导航(native <dialog>)
* ≤900px:顶栏菜单按钮打开 #site-nav-dialog,承载六个主导航链接;
* 图标导航行与旧侧边栏在此区间隐藏,窄屏只暴露一个导航菜单。
* ============================================ */
/* 全局菜单按钮:仅窄屏显示;样式与顶栏其余控件一致(44px 产品目标触控高度) */
.nav-menu-btn {
display: none;
align-items: center;
justify-content: center;
flex: 0 0 auto;
width: 44px;
min-width: 44px;
height: 44px;
padding: 0;
border: 1px solid var(--border-color);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
cursor: pointer;
transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.nav-menu-btn:hover,
.nav-menu-btn:focus {
border-color: var(--text-muted);
background: transparent;
color: var(--text-primary);
}
.nav-menu-btn .icon {
width: 20px;
height: 20px;
}
/* 窄屏(≤900px):只保留菜单按钮 + 对话框,隐藏图标导航行与旧侧边栏 */
@media (max-width: 900px) {
.nav-menu-btn {
display: inline-flex;
}
/* 窄屏顶栏主题/语言按钮最小 44px 触控面积(产品目标) */
.top-nav .nav-actions .lang-globe-btn,
.top-nav .nav-actions .btn-icon#theme-toggle {
width: 44px;
min-width: 44px;
height: 44px;
min-height: 44px;
}
.nav-links {
display: none;
}
.sidebar-toggle {
display: none;
}
.sidebar {
display: none;
}
}
/* 对话框本体:不在 #site-nav-dialog 上写 display 属性 ——
原生 UA 样式 dialog:not([open]) { display: none } 负责关闭态隐藏,
若这里覆盖 display 会让关闭的对话框重新可见。 */
#site-nav-dialog {
margin: auto;
padding: 0;
width: min(calc(100vw - 32px), 320px);
max-height: min(calc(100dvh - 32px), 640px);
border: none;
border-radius: var(--radius-xl);
background: var(--bg-card);
color: var(--text-primary);
box-shadow: var(--shadow-lg);
overflow-y: auto;
}
#site-nav-dialog::backdrop {
background: rgba(0, 0, 0, 0.55);
}
.site-nav-dialog-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--spacing-sm);
padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
border-bottom: 1px solid var(--border-color);
}
.site-nav-dialog-title {
margin: 0;
font-size: 1rem;
font-weight: 600;
color: var(--text-primary);
}
/* 关闭按钮:≥44px 触控目标(产品目标尺寸,非 WCAG 2.5.8 下限) */
.site-nav-dialog-close {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
min-width: 44px;
height: 44px;
min-height: 44px;
padding: 0;
border: none;
border-radius: var(--radius-md);
background: transparent;
color: var(--text-secondary);
cursor: pointer;
transition: background-color var(--transition-fast), color var(--transition-fast);
}
.site-nav-dialog-close:hover,
.site-nav-dialog-close:focus {
background-color: var(--bg-tertiary);
color: var(--text-primary);
}
.site-nav-dialog-nav {
padding: var(--spacing-sm);
}
.site-nav-dialog-menu {
list-style: none;
margin: 0;
padding: 0;
}
.site-nav-dialog-item + .site-nav-dialog-item {
margin-top: 2px;
}
/* 导航链接:≥44px 触控目标,主题感知文字/背景 */
.site-nav-dialog-link {
display: flex;
align-items: center;
gap: var(--spacing-sm);
min-height: 44px;
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-lg);
color: var(--text-secondary);
font-size: 0.9375rem;
font-weight: 500;
text-decoration: none;
transition: background-color var(--transition-fast), color var(--transition-fast);
}
.site-nav-dialog-link svg {
width: 18px;
height: 18px;
}
.site-nav-dialog-link:hover,
.site-nav-dialog-link:focus {
background-color: var(--bg-tertiary);
color: var(--text-primary);
}
.site-nav-dialog-link.active,
.site-nav-dialog-link[aria-current="page"] {
background-color: var(--bg-tertiary);
color: var(--text-primary);
font-weight: 600;
}
.site-nav-dialog-link:focus-visible {
outline: 2px solid var(--focus-blue);
outline-offset: 2px;
}
/* ============================================
* 顶栏右侧控件组(A 项:语言切换 + 主题切换统一为一个控件组)
* 作用域限定在 .top-nav 内,避免影响页面其他 .btn / .btn-icon;
* id / class / data-* 全部沿用,无 JS 改动。
* ============================================ */
.top-nav .lang-globe-btn,
.top-nav .btn-icon#theme-toggle {
flex: 0 0 auto;
height: 36px;
border: 1px solid var(--border-color);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
box-shadow: none;
transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.top-nav .btn-icon#theme-toggle {
width: 36px;
min-width: 36px;
padding: 0;
}
.top-nav .lang-globe-btn:hover,
.top-nav .lang-globe-btn:focus,
.top-nav .btn-icon#theme-toggle:hover,
.top-nav .btn-icon#theme-toggle:focus {
border-color: var(--text-muted);
background: transparent;
box-shadow: none;
}
/* ============================================
* iPhone Safari Specific Optimizations
* iPhone 浏览器特定优化
* ============================================ */
@supports (-webkit-touch-callout: none) {
/* 禁用双击缩放(改善触摸响应速度) */
a, button, .nav-link, .card, .btn, .tab-btn {
touch-action: manipulation;
-webkit-touch-callout: none;
}
/* 移除点击高亮(使用自定义触摸反馈) */
a, button, .nav-link, .card, .btn, .tab-btn, input, select, textarea {
-webkit-tap-highlight-color: transparent;
}
/* 输入框字体至少 16px(防止 iOS 自动缩放页面) */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
textarea,
select {
font-size: 16px !important;
}
/* 安全区适配(刘海屏、底部横条) */
.top-nav {
padding-top: env(safe-area-inset-top, 0px);
padding-left: max(var(--spacing-sm), env(safe-area-inset-left));
padding-right: max(var(--spacing-sm), env(safe-area-inset-right));
}
.main-content {
padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* 底部固定元素安全区 */
.mobile-bottom-bar,
.fixed-bottom {
padding-bottom: env(safe-area-inset-bottom, 0px);
}
}
/* 超小屏手机优化(iPhone SE / mini) */
@media (max-width: 375px) {
html {
font-size: 15px;
}
.top-nav {
padding: 4px 8px;
}
.nav-brand {
font-size: 0.85rem;
}
.nav-link {
padding: 4px 6px;
font-size: 0.75rem;
}
}
/* Note: Component styles have been moved to components.css for better organization */
/* Accessibility Utilities */
.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;
}
.skip-link {
position: absolute;
top: -40px;
left: 0;
background: var(--primary-color);
color: var(--text-white);
padding: var(--spacing-sm) var(--spacing-md);
z-index: 10000;
transition: top var(--transition-fast);
}
.skip-link:focus { top: 0; }
/* SVG Icons - Lucide Style */
.icon {
display: inline-block;
width: 1em;
height: 1em;
vertical-align: middle;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
flex-shrink: 0;
}
.icon-spin { animation: icon-spin 1s linear infinite; }
@keyframes icon-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* ============================================
* Modern CSS Features (2026)
* 容器查询、逻辑属性、无障碍增强
* ============================================ */
/* Container Queries - 现代响应式设计 */
@container (min-width: 400px) {
.card-content { padding: var(--spacing-md); }
.modal-meta { grid-template-columns: repeat(2, 1fr); }
}
/* Logical Properties - 更好的国际化支持 */
.modal-close { inset-inline-start: auto; inset-inline-end: var(--spacing-sm); }
/* :has() 选择器 - 父级选择器 */
.card:has(.card-favorite.active) { border-color: var(--accent-red); }
/* Viewport Units - 现代视口单位(仅桌面端生效) */
@media (min-width: 769px) {
.modal { min-height: 100dvh; max-height: 100dvh; }
.modal-content { max-height: calc(100dvh - var(--spacing-md) * 2); }
}
/* Focus Visible - 增强的焦点可见性 */
:focus-visible { outline: 3px solid var(--primary-color); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
/* Accent Color - 使用系统主题色 */
:root { color-scheme: light dark; accent-color: var(--primary-color); }
/* Text Balance - 文本平衡 */
.page-title, .modal-header h2 { text-wrap: balance; }
/* ============================================
* 卡片链接样式(P1-2:书籍卡片跳转到详情页)
* ============================================ */
.card-link {
display: block;
color: inherit;
text-decoration: none;
}
a.list-item-image {
display: block;
text-decoration: none;
}
.list-item-title a {
color: inherit;
text-decoration: none;
}
.list-item-title a:hover,
.list-item-title a:focus {
text-decoration: underline;
}
.card-link:hover .card-title,
.card-link:focus .card-title {
text-decoration: underline;
}
.cover-frame a {
display: block;
text-decoration: none;
}
.card-title a {
color: inherit;
text-decoration: none;
/* WCAG 2.5.8:标题链接实测 42.27×21px。
用 inline-block(不是 inline-flex)—— 多行标题仍能正常换行,inline-flex 会把
文字变成单个 flex item 从而不换行。 */
display: inline-block;
min-height: 24px;
}
.card-title a:hover,
.card-title a:focus {
text-decoration: underline;
}
/* Round3 V01 — book-journal typography, neutral theme roles, color-scheme */
:root {
--font-serif: Georgia, 'Times New Roman', 'Songti SC', 'STSong', SimSun, serif;
}
html {
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
html:not([data-theme="light"]) {
color-scheme: dark;
}
}
[data-theme="dark"] {
color-scheme: dark;
}
[data-theme="light"] {
color-scheme: light;
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-serif);
}
/* V03: main content centered at 1400px with 32px gutters (16px mobile). */
.main-content {
width: min(1400px, 100%);
margin: 0 auto;
padding-left: 32px;
padding-right: 32px;
padding-top: calc(var(--top-nav-height) + var(--spacing-md));
transition: none;
}
@media (max-width: 1199px) {
.main-content {
padding-left: 16px;
padding-right: 16px;
}
}
body:has(> .breadcrumbs) .main-content {
padding-top: var(--spacing-md);
}
.top-nav .nav-link, .top-nav .lang-globe-btn, #theme-toggle, .nav-menu-btn, body #clear-search-btn, body #empty-clear-btn {
min-width: 44px;
min-height: 44px;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
transform: none;
}
.top-nav .btn-icon#theme-toggle{min-width:44px;width:44px;height:44px;min-height:44px}.lang-dropdown .lang-option{min-height:44px;min-width:44px}@media(min-width:901px){.top-nav .nav-menu-btn{display:none}}@media(max-width:900px){.top-nav .nav-menu-btn{display:inline-flex;min-height:44px;min-width:44px}}
/* Round3 computed counterexamples */
#grid-view-featured,
#grid-view-compact {
min-height: 44px;
}
.new-books-page #publisher-filter,
.new-books-page #category-filter,
.new-books-page #days-filter,
.new-books-page #search-input {
min-height: 44px;
}
.report-card-actions .btn {
min-height: 44px;
}
/* BookRank Base Styles - Professional Business Theme with Full Dark Mode Support */
/* CSS Custom Properties - Vercel Design System Tokens */
:root {
/* Primary Colors - Vercel Black & White */
--primary-color: #171717;
--primary-light: #fafafa;
--primary-dark: #000000;
--primary-gradient: linear-gradient(135deg, #171717 0%, #000000 100%);
/* Vercel Color Palette */
--black: #171717;
--white: #ffffff;
--gray-50: #fafafa;
--gray-100: #ebebeb;
--gray-400: #808080;
--gray-500: #666666;
--gray-600: #4d4d4d;
/* WCAG AA 修正(第二轮实测):#0072f5 作正文/链接色时白底 4.44:1、
--gray-50(#fafafa) 底 4.26:1,均低于 4.5:1。
#006ee8 是**刚好达标的最浅值**(白底 4.78:1、#fafafa 底 4.58:1),
色相与观感尽量贴近原色,把设计改动压到最小。 */
--link-blue: #006ee8;
--focus-blue: hsl(212,100%,48%);
--ship-red: #ff5b4f;
--preview-pink: #de1d8d;
--develop-blue: #0a72ef;
--console-blue: #0070f3;
--console-purple: #7928ca;
--console-pink: #eb367f;
--badge-bg: #ebf5ff;
--badge-text: #0068d6;
/* Background Colors - Light Mode */
--bg-primary: var(--white);
--bg-secondary: var(--gray-50);
--bg-tertiary: var(--gray-100);
--bg-light: var(--white);
--bg-white: var(--white);
--bg-card: var(--white);
--card-bg: var(--white);
/* Text Colors - Light Mode */
--text-primary: var(--black);
--text-secondary: var(--gray-600);
--text-light: var(--gray-500);
--text-white: var(--white);
/* WCAG AA 修正(dsh-design-audit 实测):--gray-400(#808080) 作正文色时
白底仅 3.95:1、--gray-50(#fafafa) 底仅 3.78:1,均低于正文所需的 4.5:1。
这里改为专用文字色 #707070(白底 4.95:1、#fafafa 底 4.75:1)。
注意:不改 --gray-400 本身 —— 它还被 --accent-silver 渐变引用,
改调色板会连带动到非文字用途。 */
--text-muted: #707070;
--text-gold: #b8860b;
/* Border Colors */
--border-color: var(--gray-100);
--border-light: var(--gray-50);
/* Warning state (search/load failure banners) - light */
--state-warning-border: #d6a94f;
--state-warning-tint: #fdf6ec;
/* Accent Colors - Vercel Workflow Colors */
--accent-silver: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-600) 100%);
--accent-bronze: linear-gradient(135deg, var(--console-purple) 0%, var(--console-pink) 100%);
--accent-gold: linear-gradient(135deg, var(--develop-blue) 0%, var(--console-blue) 100%);
--accent-red: var(--ship-red);
--accent-green: #10b981;
--accent-blue: var(--link-blue);
--accent-purple: var(--console-purple);
/* Shadows - Vercel Style */
--shadow-ring: rgba(0,0,0,0.08) 0px 0px 0px 1px;
--shadow-ring-light: rgb(235,235,235) 0px 0px 0px 1px;
--shadow-subtle: rgba(0,0,0,0.04) 0px 2px 2px 0px;
--shadow-sm: var(--shadow-ring-light);
--shadow-md: var(--shadow-card);
--shadow-lg: var(--shadow-card-full);
--shadow-xl: var(--shadow-card-full);
--shadow-hover: var(--shadow-card-full);
--shadow-card: rgba(0,0,0,0.08) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 2px 0px, rgb(250,250,250) 0px 0px 0px 1px;
--shadow-card-full: rgba(0,0,0,0.08) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 2px 0px, rgba(0,0,0,0.04) 0px 8px 8px -8px, rgb(250,250,250) 0px 0px 0px 1px;
/* Spacing - Vercel Scale */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 2.5rem;
/* Border Radius - Vercel Scale */
--radius-sm: 2px;
--radius-md: 4px;
--radius-lg: 6px;
--radius-xl: 8px;
--radius-full: 9999px;
/* Transitions - Smooth and natural */