/* --- Main stylesheet imports --- */
/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; margin: 2.2em 0 0.6em; }

h1 { font-size: 1.95rem; letter-spacing: -0.02em; }

h2 { font-size: 1.45rem; }

h3 { font-size: 1.2rem; }

h4 { font-size: 1.05rem; }

/* The first heading inside the article shouldn't push down */
.post-content > :first-child, .home-hero > :first-child { margin-top: 0; }

p { margin: 0 0 1.05em; }

a, a:visited { color: var(--accent); text-decoration: none; text-underline-offset: 2px; text-decoration-thickness: 1px; }

.post-content a, .post-content a:visited { text-decoration: underline; }

.post-content a:hover, .post-content a:focus-visible { text-decoration: none; }

strong, b { font-weight: 600; }

hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

blockquote { margin: 1.4em 0; padding: .25em 1.1em; color: var(--text-muted); border-left: 3px solid var(--border); }

ul, ol { padding-left: 1.4em; }

li { margin: 0.25em 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* --- Home hero --- */
.home-hero { margin-bottom: 1.5rem; }

.home-hero h1 { font-size: 2.1rem; margin: 0 0 .15em; letter-spacing: -0.025em; }

.home-hero .tagline { margin: 0 0 0.5em; color: var(--text-muted); font-size: 1.1rem; }

/* --- Recent posts widget --- */
.recent-posts { margin-top: .25rem; }

.recent-heading { display: flex; align-items: center; gap: 0.4rem; font-size: .8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 0.7rem; }

.recent-heading .heading-icon { width: 16px; height: 16px; color: var(--text-muted); }

.posts-feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .25em; }

.posts-feed li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5em 1em; padding: .15em 0; }

.posts-feed a, .posts-feed a:visited { color: var(--text); font-weight: 500; }

.posts-feed a:hover, .posts-feed a:focus-visible { color: var(--accent); }

.posts-feed time { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Post / page body --- */
.post-content { font-size: 1.0625rem; line-height: 1.75; }

.post-content h1 { font-size: 2rem; }

.post-content h2 { font-size: 1.45rem; margin-top: 2em; }

.post-content h3 { font-size: 1.2rem; }

.post-meta { margin: -0.5em 0 2em; color: var(--text-muted); font-size: 0.9rem; }

.post-meta .byline { color: var(--text); }

.post-tags { margin: 3em 0 0; color: var(--text-muted); font-size: 0.85rem; }

.post-tags em { font-style: normal; color: var(--text-muted); }

/* --- Post cover image with linked source attribution --- */
.post-cover { margin: 1.75em 0 2.25em; }

.post-cover img { display: block; width: 100%; height: auto; border-radius: 6px; margin: 0; }

.post-cover figcaption { margin-top: 0.45em; font-size: 0.78rem; color: var(--text-muted); font-style: italic; text-align: center; line-height: 1.5; }

.post-cover figcaption a, .post-cover figcaption a:visited { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }

.post-cover figcaption a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Inline figures inside post body (when content uses <figure> directly) */
.post-content figure { margin: 1.75em 0; }

.post-content figure img { margin: 0; border-radius: 6px; }

.post-content figure figcaption { margin-top: 0.45em; font-size: 0.78rem; color: var(--text-muted); font-style: italic; text-align: center; line-height: 1.5; }

.post-content figure figcaption a, .post-content figure figcaption a:visited { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }

.post-content figure figcaption a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* --- Heading anchors (anchor-js) --- */
.anchorjs-link { color: var(--text-muted); text-decoration: none; margin-left: .35rem; opacity: 0; transition: opacity .15s ease; }

h1:hover .anchorjs-link, h2:hover .anchorjs-link, h3:hover .anchorjs-link, h4:hover .anchorjs-link, h5:hover .anchorjs-link, h6:hover .anchorjs-link { opacity: 0.6; }

.anchorjs-link:hover { opacity: 1 !important; color: var(--accent); }

/* --- Images inside post content --- */
.post-content img { display: block; border-radius: 6px; max-width: 100%; height: auto; margin: 1.4em auto; }

/* --- Avatar (real portrait used on /about/) --- */
.post-content img.avatar, img.avatar { display: block; width: 11rem; height: 11rem; border-radius: 50%; object-fit: cover; margin: 0 0 1.5rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.img-caption { display: block; font-size: 0.8rem; color: var(--text-muted); text-align: center; font-style: italic; margin-top: -1em; margin-bottom: 1.5em; }

/* --- Blog archive (/blog/) --- */
.archive-title { margin-top: 0; }

.archive-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }

.archive-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }

/* Archive cards: cover image with text overlaid on a palette gradient. The gradient fades to var(--bg) so text reads against the cream paper in light mode and against the warm-near-black in dark mode. */
.archive-entry { position: relative; display: block; margin: 1.25rem 0; border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); transition: box-shadow .25s ease, transform .25s ease; /* Collapse any inline whitespace inside the <li> so the cover image sits flush against the card's top edge. .archive-entry-content restores font-size / line-height for its own text. */ font-size: 0; line-height: 0; /* Clip in two ways: clip-path is the authoritative clip that respects transformed children (Chrome/Safari leak the scaled image's bottom edge past plain `overflow:hidden` + `border-radius`). isolation gives us our own stacking context. */ overflow: hidden; clip-path: inset(0 round 8px); isolation: isolate; will-change: transform; }

.archive-entry:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }

.archive-entry-link, .archive-entry-link:visited { display: block; color: inherit; text-decoration: none; }

.archive-entry-cover { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 840; object-fit: cover; }

.archive-entry-content { position: absolute; inset: auto 0 0 0; padding: 5.5rem 1.4rem 1.3rem; background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 92%, transparent) 35%, color-mix(in srgb, var(--bg) 50%, transparent) 70%, transparent 100%); color: var(--text); /* Restore type defaults that .archive-entry zeroed out for layout. */ font-size: 1rem; line-height: 1.6; }

.archive-entry-title { font-size: 1.45rem; margin: 0 0 0.3rem; color: var(--text); letter-spacing: -0.015em; line-height: 1.2; font-weight: 600; }

.archive-entry-meta { margin: 0 0 0.4rem; font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

.archive-entry-desc { margin: 0; color: var(--text-muted); font-size: 0.93rem; line-height: 1.55; }

/* --- Footer --- */
.site-footer { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; font-size: 0.85rem; color: var(--text-muted); }

.site-footer p { margin: 0; }

.site-footer a, .site-footer a:visited { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border); }

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

/* --- Social links row in footer --- */
.social-links { list-style: none; padding: 0; margin: 0 0 0.9rem; display: flex; justify-content: center; gap: 1.1rem; }

.social-links a, .social-links a:visited { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; color: var(--text-muted); text-decoration: none; transition: color .15s ease, transform .15s ease; }

.social-links a:hover, .social-links a:focus-visible { color: var(--accent); transform: translateY(-1px); }

.social-links svg { display: block; }

/* --- Tables (rare in posts) --- */
table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 0.95rem; }

th, td { text-align: left; padding: 0.55em 0.7em; border-bottom: 1px solid var(--border); }

th { color: var(--text); font-weight: 600; }

/* --- Shared components --- */
.copy-btn { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; }

/* Icon helper reused by buttons */
.btn-icon { height: 1.4em; width: 1.4em; font-size: 1.4em; flex-shrink: 0; display: inline-block; vertical-align: middle; margin-right: .5em; object-fit: contain; box-shadow: none !important; filter: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

.hidden { display: none !important; }

button:hover { opacity: .8; }

/* Copy-to-clipboard button for code blocks */
pre.copy-wrap { position: relative; }

.copy-btn { position: absolute; top: .25em; right: .25em; background: transparent; border: none; color: var(--accent); cursor: pointer; padding: 0.2em; line-height: 1; font-size: 0.7em; display: flex; align-items: center; }

.copy-btn[data-copied] { color: var(--accent); }
