/* Modern system fonts - no custom font files needed */


/* Defaults */
:root {
	--font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
	--font-family-monospace: Consolas, Menlo, Monaco, Andale Mono WT, Andale Mono, Lucida Console, Lucida Sans Typewriter, DejaVu Sans Mono, Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Courier New, Courier, monospace;
	--font-family-headers: 'Nimbus Mono PS', 'Courier New', monospace; 
	--font-weight-headers: 900;
	--font-size: 1rem;
	--line-height-base: 1.7; 
	--line-height-tight: 1.3;
	--spacing-vertical: 1rem;
}

/* Theme colors */
:root {
	--color-gray-20: #e0e0e0;
	--color-gray-50: #C0C0C0;
	--color-gray-90: #333;

	--background-color: #fff;
	--background-color-lighter: hsl(from var(--background-color) h s calc(l + 10));
	--background-color-darker: hsl(from var(--background-color) h s calc(l - 10));

	--text-color: var(--color-gray-90);
	--text-color-link: #082840;
	--text-color-link-active: #5f2b48;
	--text-color-link-visited: #17050F;

	--syntax-tab-size: 2;
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-gray-20: #e0e0e0;
		--color-gray-50: #C0C0C0;
		--color-gray-90: #dad8d8;

		/* --text-color is assigned to --color-gray-_ above */
		--text-color-link: #1493fb;
		--text-color-link-active: #6969f7;
		--text-color-link-visited: #a6a6f8;

		--background-color: #1f2022;
	}
}


/* Global stylesheet */
* {
	box-sizing: border-box;
}

@view-transition {
	navigation: auto;
}

html,
body {
	padding: 0;
	margin: 0 auto;
	font-family: var(--font-family);
	font-weight: 400;
	color: var(--text-color);
	background-color: var(--background-color);
	font-size: var(--font-size);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
html {
	overflow-y: scroll;
}
body {
	max-width: 42em;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Fluid images via https://www.zachleat.com/web/fluid-images/ */
img{
  max-width: 100%;
}
img[width][height] {
  height: auto;
}
img[src$=".svg"] {
  width: 100%;
  height: auto;
  max-width: none;
}
video,
iframe {
	width: 100%;
	height: auto;
}
iframe {
	aspect-ratio: 16/9;
}

p:last-child {
	margin-bottom: 0;
}
p {
	margin-bottom: var(--spacing-vertical);
	line-height: var(--line-height-base);
	/* Improve text flow and readability */
	text-wrap: pretty;
}

/* Better list typography */
li {
	line-height: var(--line-height-base);
	margin-bottom: 0.5rem;
}

ul, ol {
	margin-bottom: var(--spacing-vertical);
	padding-left: 1.5rem;
}

li:last-child {
	margin-bottom: 0;
}

h1,h2,h3,h4,h5,h6 {
	font-family: var(--font-family-headers);
	font-weight: var(--font-weight-headers);
}

h1 {
	font-size: 2.25rem; /* 36px */
	font-weight: 700;
}

h2 {
	font-size: 1.875rem; /* 30px */
	margin-top: calc(var(--spacing-vertical) * 2.5);
}

h3 {
	font-size: 1.5rem; /* 24px */
}

h4 {
	font-size: 1.25rem; /* 20px */
}

h5 {
	font-size: 1.125rem; /* 18px */
}

h6 {
	font-size: 1rem; /* 16px */
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Improve spacing between headings and content */
h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p {
	margin-top: 0;
}

a[href] {
	color: var(--text-color-link);
}
a[href]:visited {
	color: var(--text-color-link-visited);
}
a[href]:hover,
a[href]:active {
	color: var(--text-color-link-active);
}

main,
footer {
	padding: 1rem;
}
main :first-child {
	margin-top: 0;
}

header {
	border-bottom: 1px dashed var(--color-gray-20);
	font-family: var(--font-family-headers);
	font-weight: var(--font-weight-headers);
}

.links-nextprev {
	display: flex;
	justify-content: space-between;
	gap: .5em 1em;
	list-style: "";
	border-top: 1px dashed var(--color-gray-20);
	padding: 1em 0;
}
.links-nextprev > * {
	flex-grow: 1;
}
.links-nextprev-next {
	text-align: right;
}

table {
	margin: 1em 0;
}
table td,
table th {
	padding-right: 1em;
}

pre,
code {
	font-family: var(--font-family-monospace);
}
pre:not([class*="language-"]) {
	margin: .5em 0;
	line-height: 1.375; /* 22px /16 */
	-moz-tab-size: var(--syntax-tab-size);
	-o-tab-size: var(--syntax-tab-size);
	tab-size: var(--syntax-tab-size);
	-webkit-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
	direction: ltr;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	overflow-x: auto;
}
code {
	word-break: break-all;
}

/* Header */
header {
	display: flex;
	gap: 1em;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	padding: 1em;
}
.home-link {
	flex-grow: 1;
	font-size: 2rem;
	font-weight: 700;
	line-height: var(--line-height-tight);
}
.home-link:link:not(:hover) {
	text-decoration: none;
}
.home-logo {
	max-height: 50px;
}

/* Nav */
.nav {
	display: flex;
	gap: .5em 1em;
	padding: 0;
	margin: 0;
	list-style: none;
}
.nav-item {
	display: inline-block;
}
.nav-item a[href]:not(:hover) {
	text-decoration: none;
}
.nav a[href][aria-current="page"] {
	text-decoration: underline;
}

/* Posts list */
.postlist {
	list-style: none;
	padding: 0;
	padding-left: 1.5rem;
}
.postlist-item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	counter-increment: start-from -1;
	margin-bottom: 1em;
}
.postlist-item:before {
	display: inline-block;
	pointer-events: none;
	content: "" counter(start-from, decimal-leading-zero) ". ";
	line-height: 100%;
	text-align: right;
	margin-left: -1.5rem;
}
.postlist-date,
.postlist-item:before {
	font-size: 0.8125em; /* 13px /16 */
	color: var(--color-gray-90);
}
.postlist-date {
	word-spacing: -0.5px;
}
.postlist-link {
	font-size: 1.25rem; /* 20px */
	font-weight: 600;
	flex-basis: calc(100% - 1.5rem);
	padding-left: .25em;
	padding-right: .5em;
	text-underline-position: from-font;
	text-underline-offset: 0.15em;
	text-decoration-thickness: 2px;
	line-height: var(--line-height-tight);
}
.postlist-item-active .postlist-link {
	font-weight: bold;
}
.postlist-description {
	width: 100%;
	font-style: italic;
}

/* Tags */
.post-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-transform: capitalize;
	font-style: italic;
}
.postlist-item > .post-tag {
	align-self: center;
}

/* Tags list */
.post-metadata {
	display: inline-flex;
	flex-wrap: wrap;
	gap: .5em;
	list-style: none;
	padding: 0;
	margin: 0;
	font-family: var(--font-family-headers);
	font-weight: var(--font-weight-headers);
}
.post-metadata time {
	margin-right: 1em;
}

/* Posts */
.post-full-metadata {
	background-color: var(--background-color-lighter);
	padding: 20px;
}
.description {
	padding-bottom: var(--spacing-vertical);
	font-size: 1.25rem;
	font-style: italic;
	line-height: 1.5;
	color: var(--color-gray-90);
	font-weight: 400;
}
.gallery {
    margin: 32px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gallery a {
    display: block;
    text-decoration: none;
    max-height: 300px;
    position: relative;
}

.gallery img {
    width: 100%;
    height: 100%;
    max-height: 300px;
    object-fit: cover;
    image-rendering: auto;
    transform: translateZ(0); /* Enables hardware acceleration */
}

.gallery-alt-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    text-align: center;
    padding: 4px 6px;
    line-height: 1.2;
    display: block;
}
.post-title {
	margin-bottom: 0;
	margin-top: 0;
	font-size: 2.5rem;
	font-weight: 700;
	line-height: var(--line-height-tight);
	text-wrap: balance;
}
blockquote {
	border-left: 1px solid var(--color-gray-50);
	margin: 0;
	padding: 0 0 0rem 1.5rem;
	font-style: italic;
	line-height: 1.7;
	color: var(--color-gray-90);
}

blockquote p {
	margin-bottom: 1rem;
}

blockquote p:last-child {
	margin-bottom: 0;
}

/* Improve emphasis styling */
em, i {
	font-style: italic;
}

strong, b {
	font-weight: 600;
}

/* PhotoSwipe custom caption styling */
.pswp__custom-caption {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 10px 20px;
	border-radius: 8px;
	max-width: 80%;
	font-size: 20px;
	text-align: center;
	z-index: 1000;
}

/* Image alt text styling */
.image-alt-text {
	margin-top: 0px;
	margin-bottom: 5px;
	line-height: 1.4;
	color: #fff;
	background-color: #000;
	padding: 10px;
	font-size: 16px;
}

/* Footnote hover preview styling */
.footnote-preview {
	position: absolute;
	background: var(--background-color);
	border: 1px solid var(--color-gray-20);
	border-radius: 8px;
	padding: 12px 16px;
	max-width: 400px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 1000;
	font-size: 0.9rem;
	line-height: 1.4;
	color: var(--text-color);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(-5px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.footnote-preview > *:first-child {
	margin-top: 0;
}

.footnote-preview.show {
	opacity: 1;
	transform: translateY(0);
}


@media (prefers-color-scheme: dark) {
	.footnote-preview {
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	}
}