:root {
    --bg-color: #181A1B;
    --text-primary: #E7DFC8;
    --text-muted: #B4AA94;
    --accent: #7C9A83;
    --border-color: #2D3133;

    --font-heading: 'EB Garamond', serif;
    --font-body: 'Source Serif 4', serif;
    --font-code: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Ensure footnote backlinks scroll to a comfortable reading position (upper third of screen) */
sup[id^="fnref"] {
    scroll-margin-top: 20vh;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.65;
    margin: 0;
    padding: 0;
    font-size: 1.0625rem; /* 17px for a slightly tighter, index-like feel */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Highlight the target when jumping to a footnote */
:target {
    animation: highlight 1.5s ease-out;
}

@keyframes highlight {
    0% { background-color: rgba(124, 154, 131, 0.3); }
    100% { background-color: transparent; }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 2rem; /* slightly increased top/bottom padding */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 400;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    letter-spacing: 0.01em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
    text-decoration-color: transparent;
}

a:hover, a:focus {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--text-primary);
    text-underline-offset: 4px;
    outline: none;
}

/* Header */
.site-header {
    text-align: center;
    margin-bottom: 4rem;
}

.site-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.site-header .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4.5rem 0;
    opacity: 0.7;
}

/* Sitemap Layout */
.sitemap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.75rem;
}

@media (min-width: 768px) {
    .sitemap {
        grid-template-columns: 1fr 1fr;
        row-gap: 3.5rem;
        column-gap: 4rem;
    }
}

.section h2 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.section h2 a {
    color: inherit;
    transition: color 0.15s ease;
}

.section h2 a:hover {
    color: var(--accent);
    opacity: 1;
}

.section .desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* List Styles */
.link-list {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.link-item {
    font-family: var(--font-code);
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.link-item a {
    color: var(--accent);
}

.link-item .muted {
    color: var(--text-muted);
}

.meta-section {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.meta-label {
    opacity: 0.6;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.commit-msg code {
    background-color: var(--border-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Footer */
.site-footer {
    margin-top: 7rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 2rem;
    font-family: var(--font-code);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: left;
}

.footer-left p {
    margin: 0;
    line-height: 1.6;
}

.footer-right {
    display: flex;
    gap: 1.5rem;
}

.site-footer a {
    color: var(--text-muted);
}

.site-footer a:hover {
    color: var(--accent);
}

/* Selection */
::selection {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* --- Gallery & Lightbox Styles --- */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    gap: 1rem;
    font-family: var(--font-code);
}

.filter-buttons, .sort-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-code);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.gallery-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.gallery-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
    font-weight: 600;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .photo-gallery {
        grid-template-columns: 1fr;
    }
}

.gallery-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gallery-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.gallery-img:hover {
    opacity: 0.8;
}

.gallery-caption {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.gallery-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.gallery-meta {
    font-family: var(--font-code);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(24, 26, 27, 0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: var(--text-muted);
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: var(--text-primary);
}

#lightbox-caption {
    margin-top: 15px;
    color: var(--text-primary);
    text-align: center;
    max-width: 80%;
}

/* Code blocks and inline code */
pre {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto; /* This prevents long lines from breaking the page! */
    font-family: var(--font-code);
    font-size: 0.9em;
    line-height: 1.5;
}

code {
    font-family: var(--font-code);
    font-size: 0.9em;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.15em 0.3em;
    border-radius: 4px;
}

pre code {
    background-color: transparent;
    padding: 0;
    font-size: 1em;
}

/* Blockquotes & Articles */
blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--accent);
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 0 6px 6px 0;
    color: var(--text-primary);
}

blockquote p {
    margin: 0;
}

blockquote p + p {
    margin-top: 0.5rem;
}

.content p {
    margin-bottom: 1.5rem;
}

/* Images in content / blog posts */
.content img,
article img,
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

figure {
    margin: 2rem 0;
    text-align: center;
}

figure img {
    margin: 0 auto 0.75rem auto;
}

figcaption {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.gallery-img {
    margin: 0;
    border: none;
    box-shadow: none;
}
