Blog Design V 2.3: Gallery, Linked Timestamps & CSS Cleanup
Winter seems to be the season where I tinker with the blog most.
Over the last few days and weeks I've been fine-tuning smaller details, making some bigger additions and trying to get the CSS more organized and structured. I've been steadily adding more to the blog since I started it and noticed recently that the CSS stylesheet had gotten quite long and unwieldy.
Because of that, much of today's update isn't visually obvious. It's a lot of redundant code removal. But having a more organized stylesheet will make maintenance and future tweaks easier on my end.
The two most prominent visual updates are a new photo gallery and a refined notes link button.
Photo Gallery
The photo gallery has been on my to-do list for a while now. I was motivated to make it happen after I saw Gobino (who has inspired other design elements of my site) express his excitement for a new PIKA photo update that makes a gallery easy.
Bear Blog is super customizable and Claude is good enough at this kind of work that I managed to spin something up pretty quickly. It was based on my pre-existing embedded photos page but also requires some JS scripting in the footer section.
I'm quite happy with how it looks. It also seems to scale nicely on both desktop and mobile.
Better Note Links
Having to use an emoji to house links to individual notes has been a mild annoyance ever since I started my notes feed. For most of the year an arrow emoji (→) was the best I could come up with. It was reasonably intuitive, but I always wanted the timestamp itself to be clickable.
Sylvia (who is one of the better resources for short-form CSS styling on Bear) has had a solution for this for a while, but admitted it was a bit hacky and didn't recommend it. I could never get it to work properly either.
Claude helped me figure this one out and it's now working exactly as intended. A cleaner note with an obvious linked timestamp that mirrors my link styling everywhere else.
--
If you want to see or use any of the CSS I have on this site, you can see the full stylesheet below. Hopefully the added table of contents makes it easier to navigate. I also use the meta tag as a quasi-changelog if you want to see previous updates.
Complete Design V 2.3 CSS
/* ================================
Carlos Collazo Theme V 2.3
Black & White Minimal Theme
--------------------------------
1. Variables
2. Base
3. Layout
4. Blog & Archive Styling
5. Notes Embed Page
6. Photos Embed Page
7. Photo Gallery Page
8. Links Page
9. Upvote Button
================================ */
/* ================================
1. Variables
================================ */
:root {
--width: 640px;
--font-main: -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen-Sans, Ubuntu, Cantarell,
"Helvetica Neue", Verdana, sans-serif;
--font-secondary: var(--font-main);
--font-scale: 1em;
--background-color: #fafaf8;
--heading-color: #383e3e;
--text-color: #3b3b3b;
--link-color: var(--text-color);
--visited-color: var(--text-color);
--muted-color: #777777;
--border-color: #d8d8d8;
--code-background-color: #fcfcfc;
--code-color: #222;
--blockquote-color: #6a6a6a;
}
@media (prefers-color-scheme: dark) {
:root {
--background-color: #28282a;
--heading-color: #c2c2c2;
--text-color: #b2b2b2;
--link-color: var(--text-color);
--visited-color: var(--text-color);
--muted-color: #888888;
--border-color: #4e4e4e;
--code-background-color: #2f2f31;
--code-color: #ddd;
--blockquote-color: #a3a3a3;
}
}
/* ================================
2. Base
================================ */
body {
font-family: var(--font-main);
font-size: var(--font-scale);
margin: auto;
padding: 12px;
max-width: var(--width);
text-align: left;
background-color: var(--background-color);
word-wrap: break-word;
overflow-wrap: break-word;
line-height: 1.45;
color: var(--text-color);
}
/* --- Type --- */
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-main);
color: var(--heading-color);
margin-top: 1.2em;
margin-bottom: 0.4em;
line-height: 1.25;
}
h1 {
font-size: 1.5em;
}
p {
margin-top: 0.4em;
margin-bottom: 0.8em;
}
strong, b {
color: var(--heading-color);
}
time {
font-style: normal;
font-size: 0.9rem;
color: var(--muted-color);
}
blockquote {
border-left: 1px solid var(--blockquote-color);
margin-left: 12px;
padding-left: 10px;
color: var(--blockquote-color);
font-style: italic;
}
/* --- Links and buttons --- */
a {
color: var(--link-color);
cursor: pointer;
text-decoration: underline;
text-decoration-color: var(--border-color);
text-underline-offset: 3px;
}
a:hover {
text-decoration-color: var(--text-color);
}
button {
margin: 0;
cursor: pointer;
}
/* --- Media, tables, rules --- */
img {
max-width: 100%;
border-radius: 8px;
}
table {
width: 100%;
}
hr {
border: 0;
border-top: 1px solid var(--border-color);
}
/* --- Code --- */
code {
font-family: monospace;
padding: 2px 5px;
background-color: var(--code-background-color);
color: var(--code-color);
border-radius: 3px;
font-size: 0.875em;
}
.highlight, .code {
padding: 1px 15px;
background-color: var(--code-background-color);
color: var(--code-color);
border-radius: 3px;
margin-block-start: 1em;
margin-block-end: 1em;
overflow-x: auto;
}
pre, .highlight {
background-color: var(--code-background-color);
border-radius: 8px;
overflow-x: auto;
}
/* --- Utilities --- */
.inline {
width: auto !important;
}
.footnotes {
font-size: 0.9em;
}
/* ================================
3. Layout
================================ */
/* --- Header and nav (mobile default) --- */
header {
display: flex;
align-items: baseline;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--border-color);
margin-bottom: .75rem;
flex-wrap: wrap;
row-gap: 0.5rem; /* adds space when the nav drops to its own line below the title */
}
.title h1 {
font-size: 1.1rem;
font-weight: 550;
margin: 0;
margin-right: 1rem;
white-space: nowrap;
}
nav p {
margin: 0;
display: flex;
align-items: baseline;
gap: 0;
}
nav p > * {
margin-right: 1rem;
}
nav a {
font-size: 1rem;
color: inherit;
text-decoration: none;
}
nav a:hover {
text-decoration: underline;
text-decoration-color: var(--text-color);
}
.title {
text-decoration: none;
color: inherit;
}
/* --- Active nav links --- */
body.notes nav a[href="/notes"],
body.photos nav a[href="/photos"],
body:has(main #directory) nav a[href="/directory"],
body:has(main #now) nav a[href="/now"],
body.blog nav a[href="/archive/?q=blogs"] {
text-decoration: underline;
text-decoration-color: var(--text-color);
text-underline-offset: 3px;
}
/* --- Main and footer --- */
main {
line-height: 1.6;
margin: .75rem 0 1.5rem 0;
}
footer {
padding: 12px 0;
text-align: center;
font-size: 0.85em;
color: var(--muted-color);
border-top: 1px solid var(--border-color);
margin-top: 1.5rem;
}
/* --- Desktop sidebar --- */
@media (min-width: 769px) {
body {
max-width: none;
margin: 0;
padding-left: 210px;
padding-right: 2rem;
padding-top: 1rem;
padding-bottom: 2rem;
}
header {
position: fixed;
left: 0;
top: 0;
width: 150px;
height: 100vh;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
padding: 3rem 1.25rem;
border-bottom: none;
border-right: 1px solid var(--border-color);
background-color: var(--background-color);
margin-bottom: 0;
overflow-y: auto;
z-index: 100;
}
.title h1 {
margin-right: 0;
margin-bottom: 1.75rem;
}
nav p {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
nav p > * {
margin-right: 0;
}
main, footer {
max-width: var(--width);
}
}
/* ================================
4. Blog & Archive Styling
================================ */
ul.blog-posts {
list-style-type: none;
padding: unset;
}
ul.blog-posts li a:visited {
color: var(--visited-color);
}
ul.blog-posts li {
display: flex;
margin-bottom: 4px;
flex-direction: row;
}
ul.blog-posts > li > span {
flex: 0 0 auto;
min-width: 11ch;
}
/*Bring tag cloud to the top of the archive page */
body.blog main {
display: flex;
flex-direction: column;
}
body.blog main small {
order: -1;
}
/*Add "Tag" label above tag cloud */
body.blog main small:first-of-type::before {
content: "Tags";
display: block;
font-weight: 700;
color: var(--heading-color);
margin-bottom: 0.4em;
}
.tag-count { opacity: .7; }
/* ================================
5. Notes Embed Section
================================ */
/* Each note: text on top, date (the permalink) underneath */
.notes ul.embedded.blog-posts li {
display: grid;
grid-template-columns: max-content 1fr;
row-gap: 0em;
align-items: baseline;
padding: 0.9em;
margin-top: 0.9em;
background-color: var(--code-background-color);
border: 1px solid var(--border-color);
border-radius: 8px;
}
/* Note text spans the full width, in the top row */
.notes ul.embedded.blog-posts > li > div {
grid-column: 1 / -1;
grid-row: 1;
min-width: 0;
}
.notes ul.embedded.blog-posts > li div p:first-child {
margin-top: 0;
}
/* Date sits in the bottom row, first column */
.notes ul.embedded.blog-posts > li > span {
grid-column: 1;
grid-row: 2;
display: inline-flex;
align-items: baseline;
white-space: nowrap;
}
/* The date looks like a link... */
.notes ul.embedded.blog-posts li time {
color: var(--muted-color);
text-decoration: underline;
text-decoration-color: var(--border-color);
text-underline-offset: 3px;
}
.notes ul.embedded.blog-posts li:has(> a:hover) time {
text-decoration-color: var(--text-color);
}
/* ...because the post link is stretched invisibly over it */
.notes ul.embedded.blog-posts > li > a {
grid-column: 1;
grid-row: 2;
z-index: 1;
align-self: stretch;
font-size: 0;
}
.notes ul.embedded.blog-posts > li > a:focus-visible {
outline: 2px solid var(--text-color);
outline-offset: 2px;
border-radius: 2px;
}
/* Content inside notes */
.notes img {
max-width: 350px;
width: 100%;
height: auto;
display: block;
margin: 0.1em 0;
}
.notes ul.embedded.blog-posts li details pre {
overflow-x: auto;
max-width: 100%;
}
/* Safety net: lists inside note content render normally */
.notes ul.embedded.blog-posts > li > div ul,
.notes ul.embedded.blog-posts > li > div ol {
padding-left: 1.5em;
margin: 0.5em 0;
}
.notes ul.embedded.blog-posts > li > div ul {
list-style: disc;
}
.notes ul.embedded.blog-posts > li > div ol {
list-style: decimal;
}
.notes ul.embedded.blog-posts > li > div li {
display: list-item;
padding: 0;
margin: 0;
background: none;
border: 0;
border-radius: 0;
}
.notes .pagination-row {
display: flex;
justify-content: flex-end;
align-items: baseline;
margin-top: 1rem;
font-size: .95em;
}
/* ================================
6. Photos Embed Section
================================ */
.photos ul.embedded.blog-posts li {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
padding: 0;
border: none;
}
.photos ul.embedded.blog-posts li a {
order: 1;
white-space: normal;
}
.photos ul.embedded.blog-posts > li > span {
order: 2;
}
.photos ul.embedded.blog-posts li time {
text-decoration: none;
color: var(--muted-color);
}
.photos ul.embedded.blog-posts li div {
order: 3;
flex-basis: 100%;
}
.photos ul.embedded.blog-posts li p:has(img) {
display: block;
}
.photos ul.embedded.blog-posts li p:not(:has(img)) {
display: none;
}
.photos ul.embedded.blog-posts li p:has(img) ~ p:has(img) {
display: none !important;
}
.photos ul.embedded.blog-posts li p img:not(:first-of-type) {
display: none !important;
}
.photos .pagination-row {
display: flex;
justify-content: flex-end;
align-items: baseline;
margin-top: 1rem;
font-size: .95em;
}
/* ================================
7. Gallery Page
================================ */
/* --- Gallery grid (built by JS) --- */
.photo-grid {
--row-h: 200px; /* target row height; raise for bigger photos */
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 0.25rem;
margin-top: 1rem;
}
/* keeps the last row from stretching to full width */
.photo-grid::after {
content: "";
flex-grow: 10000;
}
.photo-tile {
--ar: 1.5; /* JS replaces this once the image loads */
flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row-h));
aspect-ratio: var(--ar);
min-width: 0;
overflow: hidden;
border-radius: 6px;
background: var(--code-background-color);
}
.photo-tile img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 0;
}
.photo-tile:focus-visible {
outline: 2px solid var(--text-color);
outline-offset: 2px;
}
/* A wider gallery on desktop (main is capped at 640px) */
@media (min-width: 769px) {
body.gallery main {
max-width: 900px;
}
}
/* Smaller rows on mobile = more photos per row */
@media (max-width: 768px) {
.photo-grid {
--row-h: 95px;
gap: 0.2rem;
}
}
/* --- No-JS fallback: every photo, text hidden --- */
.gallery ul.embedded.blog-posts li
/* ================================
8. Links Page
================================ */
.links main > p > a {
display: block;
padding: 0.6rem 0.85rem;
border: 1px solid var(--border-color);
border-radius: 6px;
text-decoration: none;
color: var(--text-color);
background-color: var(--code-background-color);
max-width: 360px;
}
.links main > p > a:hover {
border-color: var(--text-color);
}
/* ================================
9. Upvote Button
================================ */
:is(.post, .page) .upvote-button {
display: inline-flex !important;
flex-direction: row !important;
align-items: center !important;
gap: 0.2rem;
margin-block: 1rem 0.8rem;
padding: 0;
border: none;
background: none;
color: var(--text-color);
font-family: inherit;
font-size: inherit;
cursor: pointer;
transition: transform 0.15s ease;
}
:is(.post, .page) .upvote-button:hover {
transform: scale(1.15);
}
:is(.post, .page) .upvote-button svg {
display: none !important;
}
:is(.post, .page) .upvote-button::before {
content: "♡";
font-size: 1.3rem;
line-height: 1;
color: var(--text-color);
transition: color 0.15s ease;
}
:is(.post, .page) .upvote-button .upvote-count {
display: none !important;
}
:is(.post, .page) .upvote-button:is(.upvoted, [disabled]) {
cursor: default;
}
:is(.post, .page) .upvote-button:is(.upvoted, [disabled])::before {
content: "♥";
color: var(--text-color);
}
:is(.post, .page) .upvote-button:is(.upvoted, [disabled]) .upvote-count {
color: var(--text-color);
}
:is(.post, .page) .upvote-button:focus-visible {
outline: 2px solid var(--text-color);
outline-offset: 2px;
border-radius: 2px;
}