Add Table of Contents

also refactor CSS
This commit is contained in:
2026-04-20 15:44:05 +02:00
parent 7ce4c02dee
commit 9639a70572
8 changed files with 187 additions and 56 deletions
+102 -33
View File
@@ -325,59 +325,32 @@ textarea {
box-sizing: border-box;
}
/* === Diary views === */
.diary-section {
margin: 2rem 0;
padding-top: 1.5rem;
border-top: 1px dashed var(--secondary);
}
.diary-section:first-child {
border-top: none;
padding-top: 0;
margin-top: 0;
}
.diary-section h2 {
font-size: 1.2rem;
color: var(--text);
margin-bottom: 0.75rem;
font-weight: normal;
}
.diary-photo-count {
/* === Muted text === */
.muted {
color: var(--text-muted);
font-size: 0.85rem;
}
.diary-photo-grid {
/* === Photo grid === */
.photo-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 0.4rem;
margin-top: 0.75rem;
}
.diary-photo-grid a {
.photo-grid a {
display: block;
line-height: 0;
}
.diary-photo-grid img {
.photo-grid img {
width: 100%;
height: 140px;
object-fit: cover;
display: block;
}
.diary-section .content {
margin-bottom: 0.75rem;
}
/* === Section edit links === */
.section-edit {
margin-left: 0.75rem;
}
/* === Empty state === */
.empty {
padding: 1rem;
@@ -405,7 +378,99 @@ hr {
background: var(--primary-hover);
}
/* === Table of contents === */
.toc {
position: fixed;
top: 1rem;
right: 1rem;
width: 14rem;
max-height: calc(100vh - 2rem);
overflow-y: auto;
border: 1px solid var(--secondary);
background: var(--bg);
padding: 0.5rem 0.75rem;
font-size: 0.85rem;
}
.toc-header {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
border-bottom: 1px dashed var(--secondary);
padding-bottom: 0.25rem;
margin-bottom: 0.4rem;
}
.toc ul {
list-style: none;
margin: 0;
padding: 0;
}
.toc li {
margin: 0.15rem 0;
}
.toc a {
color: var(--link);
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.toc a:hover {
color: var(--link-hover);
}
.toc-h2 {
padding-left: 0.8rem;
}
.toc-h3 {
padding-left: 1.6rem;
}
.toc-toggle {
display: none;
}
/* === Responsive === */
@media (max-width: 1100px) {
.toc-toggle {
display: block;
background: none;
border: 1px solid var(--secondary);
color: var(--text);
font: inherit;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.05em;
cursor: pointer;
padding: 0.4rem 0.75rem;
margin: 1rem auto;
width: calc(100% - 2rem);
max-width: 860px;
}
.toc-toggle::before {
content: "▸ ";
color: var(--secondary);
}
.toc-toggle[aria-expanded="true"]::before {
content: "▾ ";
}
.toc {
position: static;
display: none;
width: calc(100% - 2rem);
max-width: 860px;
margin: 0 auto 1rem;
max-height: none;
}
.toc.is-open {
display: block;
}
}
@media (max-width: 600px) {
header {
padding: 0.5rem 0.75rem;
@@ -416,4 +481,8 @@ hr {
textarea {
min-height: 50vh;
}
.toc-toggle,
.toc.is-open {
width: calc(100% - 1.5rem);
}
}