Files
kennethreitz fd970be0ba Upgrade to Responder 3.12; thumbnails, smart 404s, and a faster site
- Responder 3.10-3.12: auto ETags, request size limits, timeouts,
  Prometheus metrics at /metrics; essay release count is now seven
- Gallery thumbnails via /thumb route (24MB pages drop to ~400KB)
- Dark-mode flash eliminated; theme applies before first paint
- 404 pages suggest the closest-matching content
- Long-lived caching for static assets; lazy-loaded content images
- Skip link and keyboard-accessible nav dropdowns
- Per-essay OG image in Article structured data
- Homepage: trim the quest log clause

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 00:40:27 -04:00

381 lines
7.0 KiB
CSS

/* Prevent FOUC by hiding content until stylesheets load */
html {
visibility: hidden;
opacity: 0;
}
html.loaded {
visibility: visible;
opacity: 1;
transition: opacity 0.1s ease-in;
}
/* Legend dots for content guide */
.legend-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 0.3rem;
vertical-align: middle;
}
/* Reading progress indicator */
.reading-progress {
position: fixed;
top: 0;
left: 0;
width: 0%;
height: 2px;
background: #333;
z-index: 1000;
transition: width 0.1s ease-out;
}
/* Header and nav z-index for dropdown stacking */
header {
position: relative;
z-index: 9999;
}
nav {
position: relative;
z-index: 9999;
}
nav > a, nav > .nav-dropdown {
margin-right: 1rem;
}
.nav-dropdown {
position: relative;
display: inline-block;
}
.nav-dropdown-trigger {
cursor: pointer;
color: inherit;
text-decoration: underline;
padding-bottom: 1rem;
display: inline-block;
}
.nav-dropdown-content {
display: none;
position: absolute;
top: 100%;
left: 0;
background: white;
border: 1px solid #ddd;
border-radius: 4px;
min-width: 250px;
max-width: 400px;
max-height: 500px;
overflow-y: auto;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
z-index: 10000;
padding: 0.75rem;
}
.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content,
.nav-dropdown-content:hover {
display: block;
}
/* Skip link: invisible until focused, for keyboard and screen-reader users. */
.skip-link {
position: absolute;
left: -9999px;
top: 0;
z-index: 10001;
background: #fffff8;
color: #111;
padding: 0.5rem 1rem;
border: 1px solid #ddd;
border-radius: 0 0 4px 0;
}
.skip-link:focus {
left: 0;
}
body.dark-mode .skip-link {
background: #0d1117;
color: #e5e5e5;
border-color: #333;
}
.tree-item {
padding: 0.35rem 0;
display: flex;
align-items: center;
gap: 0.5rem;
}
.tree-item-icon {
flex-shrink: 0;
width: 18px;
height: 18px;
}
.tree-item a {
color: #333;
text-decoration: none;
flex: 1;
}
.tree-item a:hover {
text-decoration: underline;
}
.tree-folder a {
font-weight: 500;
}
body.dark-mode .nav-dropdown-content {
background: #1a1a1a;
border-color: #333;
}
body.dark-mode .tree-item a {
color: #ccc;
}
@media (prefers-color-scheme: dark) {
.nav-dropdown-content {
background: #1a1a1a;
border-color: #333;
}
.tree-item a {
color: #ccc;
}
}
.github-corner {
position: absolute;
top: 0;
right: 0;
z-index: 9998;
opacity: 0.85;
transition: opacity 0.3s ease;
}
.github-corner:hover {
opacity: 0.8;
}
.github-corner-img {
width: 80px;
height: 80px;
}
body.dark-mode .github-corner {
opacity: 0.25;
}
body.dark-mode .github-corner-img {
filter: invert(1);
}
@media (max-width: 760px) {
.github-corner-img {
width: 50px;
height: 50px;
}
}
.theme-toggle {
position: fixed;
bottom: 2rem;
right: 2rem;
background: none;
border: none;
cursor: pointer;
font-size: 1.5rem;
padding: 0.5rem;
margin: 0;
opacity: 0.15;
transition: opacity 0.3s ease;
line-height: 1;
z-index: 9999;
}
.theme-toggle:hover {
opacity: 0.8;
}
.sun-icon,
.moon-icon {
display: none;
}
body.light-mode .sun-icon {
display: inline;
}
body.dark-mode .moon-icon {
display: inline;
}
/* Dark mode styles using body class */
body.dark-mode {
background-color: #0d1117;
color: #c9d1d9;
}
/* Light mode styles to override media query */
body.light-mode {
background-color: #fffff8;
color: #111;
}
@media (max-width: 760px) {
.theme-toggle {
font-size: 1.3rem;
bottom: 1rem;
right: 1rem;
padding: 0.4rem;
}
}
main {
position: relative;
z-index: 1;
}
article {
position: relative;
z-index: 1;
}
/* Dropdown navigation styles */
.nav-dropdown {
position: relative;
display: inline-block;
padding: 0.5rem;
margin: -0.5rem;
z-index: 9999;
}
.nav-dropdown .dropdown-content {
display: none;
position: absolute;
top: 100%;
left: 0;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
z-index: 999999;
min-width: 280px;
padding: 0.5rem 0;
margin-top: -1px;
}
.nav-dropdown:hover .dropdown-content {
display: block;
}
.nav-dropdown .dropdown-content a {
display: block;
padding: 0.5rem 1rem;
color: #333;
text-decoration: none;
border-bottom: none;
font-size: 0.9rem;
line-height: 1.4;
}
.nav-dropdown .dropdown-content a:hover {
background-color: #f5f5f5;
}
.nav-dropdown .dropdown-content a .index-description {
display: block;
font-size: 0.75rem;
color: #666;
margin-top: 0.1rem;
}
.nav-dropdown > a::after {
content: "\00a0\25BC";
font-size: 0.7rem;
color: #999;
}
/* --- Footer site map --- */
.footer-map {
margin-top: 2.5rem;
padding-top: 1rem;
border-top: 1px solid #ddd;
font-size: 0.95rem;
line-height: 2;
}
.footer-map a { color: #888; text-decoration: none; }
.footer-map a:hover { color: #111; text-decoration: underline; }
.footer-map .sep { margin: 0 0.45rem; color: #ccc; }
body.dark-mode .footer-map { border-top-color: #333; }
body.dark-mode .footer-map a { color: #777; }
body.dark-mode .footer-map a:hover { color: #ddd; }
body.dark-mode .footer-map .sep { color: #444; }
/* --- Keep Reading (related essays) --- */
.related-essays {
margin-top: 3.5rem;
padding-top: 1.25rem;
border-top: 1px solid #ddd;
}
.related-essays h2 {
font-size: 1.3rem;
font-style: italic;
margin-top: 0;
margin-bottom: 0.75rem;
}
.related-essays ul { list-style: none; padding-left: 0; margin-top: 0; }
.related-essays li {
display: flex;
align-items: center;
gap: 0.55rem;
margin: 0.5rem 0;
font-size: 1.15rem;
}
.related-essays li::marker { content: none; }
.related-icon {
width: 18px; height: 18px;
flex-shrink: 0;
display: inline-block;
}
body.dark-mode .related-essays { border-top-color: #333; }
/* --- Archive filter + year counts --- */
.archive-filter {
flex: 1;
min-width: 220px;
max-width: 24rem;
font-family: inherit;
font-size: 0.95rem;
padding: 0.45rem 0.8rem;
border: 1px solid #ccc;
border-radius: 6px;
background: transparent;
color: inherit;
outline: none;
}
.archive-filter:focus { border-color: #888; }
.filter-count { color: #999; font-size: 0.9rem; white-space: nowrap; }
.year-count {
font-size: 0.5em;
font-weight: normal;
color: #999;
vertical-align: middle;
border: 1px solid #ddd;
border-radius: 999px;
padding: 0.1em 0.7em;
margin-left: 0.4rem;
}
body.dark-mode .archive-filter { border-color: #444; }
body.dark-mode .archive-filter:focus { border-color: #777; }
body.dark-mode .year-count { border-color: #3a3a3a; color: #777; }