Files
awesome-python/website/static/style.css
Vinta Chen 818950f442 fix(website): fix sticky header on mobile and add border shadow
Move overflow-x: auto from .table-wrap to the mobile breakpoint only,
so horizontal scrolling only applies on small screens. Add box-shadow
to sticky thead th for visual separation. Reset th position to static
on mobile to avoid stacking context issues.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-22 02:25:58 +08:00

690 lines
13 KiB
CSS

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--font-display: Georgia, "Noto Serif", "Times New Roman", serif;
--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
--text-xs: 0.9375rem;
--text-sm: 1rem;
--text-base: 1.125rem;
--bg: oklch(99.5% 0.003 240);
--bg-hover: oklch(97% 0.008 240);
--text: oklch(15% 0.005 240);
--text-secondary: oklch(35% 0.005 240);
--text-muted: oklch(50% 0.005 240);
--border: oklch(90% 0.005 240);
--border-strong: oklch(75% 0.008 240);
--border-heavy: oklch(25% 0.01 240);
--bg-input: oklch(94.5% 0.035 240);
--accent: oklch(42% 0.14 240);
--accent-hover: oklch(32% 0.16 240);
--accent-light: oklch(97% 0.015 240);
--highlight: oklch(93% 0.10 90);
--highlight-text: oklch(35% 0.10 90);
--tag-text: oklch(45% 0.06 240);
--tag-hover-bg: oklch(93% 0.025 240);
}
html { font-size: 16px; }
body {
font-family: var(--font-body);
background: var(--bg);
color: var(--text);
line-height: 1.55;
min-height: 100vh;
display: flex;
flex-direction: column;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
/* === Skip Link === */
.skip-link {
position: absolute;
left: -9999px;
top: 0;
padding: 0.5rem 1rem;
background: var(--text);
color: var(--bg);
font-size: var(--text-xs);
font-weight: 700;
z-index: 200;
}
.skip-link:focus { left: 0; }
/* === Hero === */
.hero {
max-width: 1400px;
margin: 0 auto;
padding: 3.5rem 2rem 1.5rem;
}
.hero-main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
}
.hero-submit {
flex-shrink: 0;
padding: 0.4rem 1rem;
border: 1px solid var(--border-strong);
border-radius: 4px;
font-size: var(--text-sm);
color: var(--text);
text-decoration: none;
white-space: nowrap;
transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.hero-submit:hover {
border-color: var(--accent);
background: var(--accent-light);
color: var(--accent);
text-decoration: none;
}
.hero-submit:active {
transform: scale(0.97);
}
.hero-submit:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.hero h1 {
font-family: var(--font-display);
font-size: clamp(2rem, 5vw, 3rem);
font-weight: 400;
letter-spacing: -0.01em;
line-height: 1.1;
text-wrap: balance;
color: var(--accent);
margin-bottom: 0.75rem;
}
.hero-sub {
font-size: var(--text-base);
color: var(--text-secondary);
line-height: 1.6;
margin-bottom: 0.5rem;
text-wrap: pretty;
}
.hero-sub a { color: var(--text-secondary); font-weight: 600; }
.hero-sub a:hover { color: var(--accent); }
.hero-gh {
font-size: var(--text-sm);
color: var(--text-muted);
font-weight: 500;
}
.hero-gh:hover { color: var(--accent); }
/* === Controls === */
.controls {
max-width: 1400px;
margin: 0 auto;
padding: 0 2rem 1rem;
}
.search-wrap {
position: relative;
margin-bottom: 0.75rem;
}
.search-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
color: var(--text-muted);
pointer-events: none;
}
.search {
width: 100%;
padding: 0.65rem 1rem 0.65rem 2.75rem;
border: 1px solid transparent;
border-radius: 4px;
background: var(--bg-input);
font-family: var(--font-body);
font-size: var(--text-sm);
color: var(--text);
transition: border-color 0.15s, background 0.15s;
}
.search::placeholder { color: var(--text-muted); }
.search:focus {
outline: 2px solid var(--accent);
outline-offset: 2px;
border-color: var(--accent);
background: var(--bg);
}
.filter-bar {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 0;
font-size: var(--text-sm);
color: var(--text-secondary);
opacity: 0;
transform: translateY(-4px);
pointer-events: none;
transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.25, 1, 0.5, 1);
}
.filter-bar.visible {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
.filter-bar strong {
color: var(--text);
}
.filter-clear {
background: none;
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.35rem 0.65rem;
font-family: inherit;
font-size: var(--text-xs);
color: var(--text-muted);
cursor: pointer;
transition: border-color 0.15s, color 0.15s;
}
.filter-clear:active {
transform: scale(0.97);
}
.filter-clear:hover {
border-color: var(--text-muted);
color: var(--text);
}
.filter-clear:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* === Table === */
.table-wrap {
width: 100%;
padding: 0;
}
.table-wrap:focus {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
font-size: var(--text-sm);
}
.table thead th {
text-align: left;
font-weight: 700;
font-size: var(--text-base);
color: var(--text);
padding: 0.65rem 0.75rem;
border-bottom: 2px solid var(--border-heavy);
position: sticky;
top: 0;
background: var(--bg);
z-index: 10;
white-space: nowrap;
box-shadow: 0 1px 0 var(--border);
}
.table thead th:first-child,
.table tbody td:first-child {
padding-left: max(2rem, calc(50vw - 700px + 2rem));
}
.table thead th:last-child,
.table tbody td:last-child {
padding-right: max(2rem, calc(50vw - 700px + 2rem));
}
.table tbody td {
padding: 0.7rem 0.75rem;
border-bottom: 1px solid var(--border);
vertical-align: top;
transition: background 0.15s;
}
.table tbody tr.row:not(.open):hover td {
background: var(--bg-hover);
}
.table tbody tr[hidden] { display: none; }
.col-num {
width: 3rem;
color: var(--text-muted);
font-variant-numeric: tabular-nums;
text-align: left;
}
.col-name {
width: 30%;
overflow-wrap: anywhere;
}
.col-name > a {
font-weight: 500;
color: var(--accent);
text-decoration: none;
}
.col-name > a:hover { text-decoration: underline; color: var(--accent-hover); }
/* === Sortable Headers === */
th[data-sort] {
cursor: pointer;
user-select: none;
}
th[data-sort] {
transition: color 0.15s ease;
}
th[data-sort]:hover {
color: var(--accent);
}
th[data-sort]:active {
color: var(--accent-hover);
}
th[data-sort]::after {
content: " ▼";
opacity: 0;
transition: opacity 0.15s;
}
th[data-sort="name"]::after {
content: " ▲";
}
th[data-sort]:hover::after {
opacity: 1;
}
th[data-sort].sort-desc::after {
content: " ▼";
opacity: 1;
}
th[data-sort].sort-asc::after {
content: " ▲";
opacity: 1;
}
/* === Stars Column === */
.col-stars {
width: 5rem;
font-variant-numeric: tabular-nums;
white-space: nowrap;
color: var(--text-secondary);
text-align: right;
}
/* === Source Badges === */
.source-badge {
display: inline-block;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.03em;
color: var(--text-muted);
background: var(--bg-input);
padding: 0.15rem 0.45rem;
border-radius: 3px;
white-space: nowrap;
}
.tag-source {
background: var(--bg-input);
color: var(--text-muted);
font-weight: 600;
}
/* === Arrow Column === */
.col-arrow {
width: 2.5rem;
text-align: center;
}
.arrow {
display: inline-block;
font-size: 0.8rem;
color: var(--accent);
transition: transform 0.15s ease;
}
.row.open .arrow {
transform: rotate(90deg);
}
/* === Row Click === */
.row { cursor: pointer; }
.row:active td { background: var(--bg-hover); }
.row:focus-visible td {
outline: none;
background: var(--bg-hover);
box-shadow: inset 2px 0 0 var(--accent);
}
/* === Expand Row === */
.expand-row {
display: none;
}
.row.open + .expand-row {
display: table-row;
}
.row.open td {
background: var(--accent-light);
border-bottom-color: transparent;
padding-bottom: 0.1rem;
}
.expand-row td {
padding: 0.15rem 0.75rem 0.75rem;
background: var(--accent-light);
border-bottom: 1px solid var(--border);
}
@keyframes expand-in {
from {
opacity: 0;
transform: translateY(-4px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.expand-content {
font-size: var(--text-sm);
color: var(--text-secondary);
line-height: 1.6;
text-wrap: pretty;
animation: expand-in 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
.expand-tags {
display: flex;
gap: 0.4rem;
margin-bottom: 0.4rem;
}
.expand-tag {
font-size: var(--text-xs);
color: var(--tag-text);
background: var(--bg);
padding: 0.15rem 0.4rem;
border-radius: 3px;
}
.expand-also-see {
margin-top: 0.25rem;
font-size: var(--text-xs);
color: var(--text-muted);
}
.expand-also-see a {
color: var(--accent);
text-decoration: none;
}
.expand-also-see a:hover {
text-decoration: underline;
}
.expand-meta {
margin-top: 0.25rem;
font-size: var(--text-xs);
color: var(--text-muted);
font-weight: normal;
}
.expand-meta a {
color: var(--accent);
text-decoration: none;
}
.expand-meta a:hover {
text-decoration: underline;
}
.expand-sep {
margin: 0 0.25rem;
color: var(--border);
}
.col-cat {
white-space: nowrap;
}
.col-cat .tag + .tag {
margin-left: 0.35rem;
}
/* === Last Commit Column === */
.col-commit {
width: 9rem;
white-space: nowrap;
color: var(--text-muted);
}
/* === Tags === */
.tag {
position: relative;
background: var(--accent-light);
border: none;
font-family: inherit;
font-size: var(--text-xs);
color: var(--tag-text);
cursor: pointer;
padding: 0.25rem 0.5rem;
border-radius: 3px;
white-space: nowrap;
transition: background 0.15s, color 0.15s;
}
/* Expand touch target to 44x44px minimum */
.tag::after {
content: "";
position: absolute;
inset: -0.5rem -0.25rem;
}
.tag:active {
transform: scale(0.95);
}
.tag:hover {
background: var(--tag-hover-bg);
color: var(--accent);
}
.tag:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 1px;
}
.tag.active {
background: var(--highlight);
color: var(--highlight-text);
font-weight: 600;
}
/* === Back to Top === */
.back-to-top {
position: fixed;
bottom: 2rem;
left: 50%;
margin-left: -2rem;
background: var(--bg);
border: 1px solid var(--border-strong);
border-radius: 4px;
padding: 0.4rem 0.75rem;
font-family: var(--font-body);
font-size: var(--text-xs);
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
opacity: 0;
transform: translateY(0.5rem);
transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s, color 0.15s;
z-index: 50;
}
.back-to-top[hidden] { display: none; }
.back-to-top.visible {
opacity: 1;
transform: translateY(0);
}
.back-to-top:hover {
border-color: var(--accent);
color: var(--accent);
}
.back-to-top:active {
transform: scale(0.95);
}
.back-to-top:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
@media (max-width: 640px) {
.back-to-top { bottom: 1.25rem; }
}
/* === Noscript === */
.noscript-msg {
text-align: center;
padding: 1rem;
color: var(--text-muted);
}
/* === No Results === */
.no-results {
max-width: 1400px;
margin: 0 auto;
padding: 3rem 2rem;
font-size: var(--text-base);
color: var(--text-muted);
text-align: center;
}
/* === Footer === */
.footer {
margin-top: auto;
border-top: none;
width: 100%;
padding: 1.25rem 2rem;
font-size: var(--text-xs);
color: var(--text-muted);
background: var(--bg-input);
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5rem;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { color: var(--accent-hover); text-decoration: underline; }
.footer-sep { color: var(--border-strong); }
/* === Responsive === */
@media (max-width: 900px) {
.col-commit { display: none; }
.tag-group { display: none; }
.col-name { width: 50%; }
}
@media (max-width: 640px) {
.table-wrap { overflow-x: auto; }
.table thead th { position: static; }
.hero { padding: 2rem 1.25rem 1rem; }
.controls { padding: 0 1.25rem 0.75rem; }
.table { table-layout: auto; }
.table thead th,
.table tbody td {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.table thead th:first-child,
.table tbody td:first-child { padding-left: 0.25rem; }
.table thead th:last-child,
.table tbody td:last-child { padding-right: 0.25rem; }
.table thead th { font-size: var(--text-sm); }
.col-num { width: 2rem; }
.col-stars { width: 4.75rem; }
.col-arrow { width: 1.25rem; }
.col-cat { display: none; }
.col-name {
width: auto;
white-space: normal;
}
.footer { padding: 1.25rem; justify-content: center; flex-wrap: wrap; }
}
/* === Screen Reader Only === */
.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;
}
/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}