/* Defaults */
:root {
        /* main */
        --font-family: 
                "Hiragino Mincho ProN",
                "Yu Mincho",
                "YuMincho",
                "HiraMinProN-W3",
                "HG明朝E",
                "MS P明朝",
                "MS Mincho",
                Georgia,
                serif;
        
        /* code  */
        --font-family-monospace: 
                "SF Mono",
                "Cascadia Code",
                "Menlo",
                "Consolas",
                "Courier New",
                monospace;
}

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

	--background-color: #fffff8;

	--text-color: var(--color-gray-90);
	--text-color-link: #0d0d0d;
	--text-color-link-active: #666666;
	--text-color-link-visited: #333333;

	--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: #15202b;
	}
}
*/

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

@view-transition {
	navigation: auto;
}

html,
body {
	padding: 0;
	margin: 0 auto;
	font-family: var(--font-family);
	color: var(--text-color);
	background-color: var(--background-color);
}
html {
	overflow-y: scroll;
}
body {
	max-width: 680px;

	line-height: 1.8;
	letter-spacing: 0.05em;
	font-size: 1.125rem;

	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	padding: 2em 1.5em;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden:not(:focus):not(:active) {
	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;
	margin-bottom: 1.5em;
	max-width: 100ch;
}
p {
	line-height: 1.75;
}

li {
	line-height: 1.5;
}

a[href] {
	color: var(--text-color-link);
	text-decoration: underline;
	text-decoration-color: rgba(0, 0, 0, 0.3);
	text-underline-offset: 0.2em;
}
a[href]:visited {
	color: var(--text-color-link-visited);
}
a[href]:hover,
a[href]:active {
	color: var(--text-color-link-active);
	text-decoration-color: var(--text-color-link-active);
}

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

h1, h2, h3, h4, h5, h6 {
	font-family: 
		-apple-system,
		BlinkMacSystemFont,
		"Hiragino Kaku Gothic ProN",
		"Yu Gothic UI",
		sans-serif;
	
	line-height: 1.4;
	letter-spacing: 0.08em;
	font-weight: 600;
	margin-top: 1em;
	margin-bottom: 0.8em;
}

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

#skip-link {
	text-decoration: none;
	background: var(--background-color);
	color: var(--text-color);
	padding: 0.5rem 1rem;
	border: 1px solid var(--color-gray-90);
	border-radius: 2px;
}

/* Prevent visually-hidden skip link fom pushing content around when focused */
#skip-link.visually-hidden:focus {
	position: absolute;
	top: 1rem;
	left: 1rem;
	/* Ensure it is positioned on top of everything else when it is shown */
	z-index: 999;
}

.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;
}
code {
	font-size: 0.875em;
	background-color: #f8f8f5;
	padding: 0.15em 0.4em;
	border-radius: 3px;
}

pre {
	line-height: 1.5;
	font-size: 0.875rem;
	background-color: #fafaf8;
	padding: 1.5em;
	border-radius: 4px;
	border-left: 3px solid #d0d0d0;
	overflow-x: auto;
}

pre code {
	background-color: transparent;
	padding: 0;
}



/* 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: 1em; /* 16px /16 */
	font-weight: 700;
}
.home-link:link:not(:hover) {
	text-decoration: none;
}

/* 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 {
	counter-reset: start-from var(--postlist-index);
	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.1875em; /* 19px /16 */
	font-weight: 700;
	flex-basis: calc(100% - 1.5rem);
	padding-left: .25em;
	padding-right: .5em;
	text-underline-position: from-font;
	text-underline-offset: 0;
	text-decoration-thickness: 1px;
}
.postlist-item-active .postlist-link {
	font-weight: bold;
}

/* 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;
	margin-bottom: 1.5em;
	font-size: 0.9rem;	
}
.post-metadata time {
	margin-right: 1em;
}

blockquote {
	margin-left: 0;
	padding-left: 2em;
	border-left: 3px solid #d0d0d0;
	font-style: italic;
	color: #4a4a4a;

}

/* sidenotes */
@media (min-width: 1200px) {
	body {
		max-width: 1200px;
		margin: 0 auto;
		padding: 2em 12.5%; 
		width: auto;
	}
	
	main {
		width: 100%;
		padding: 0;
		overflow: visible; 
	}
	
	main p {
		width: 65%;
		max-width: none;
		margin-bottom: 2rem;
	}
	
	main h1, main h2, main h3, main h4, main h5, main h6 {
		width: 55%;
	}
	
	main > ul, main > ol, main > blockquote {
		width: 55%;
	}
	
	main pre {
		width: 55%;
	}
	
	.sidenote {
		float: right;
		clear: right;
		margin-right: -55%; 
		width: 45%; 
		margin-top: 0.3rem;
		margin-bottom: 1rem;
		font-size: 0.95rem;
		line-height: 1.6;
		letter-spacing: 0.03em;
		position: relative;
		padding-left: 1rem;
		color: #333333;
		/* border-left: 1px solid #e0e0e0 */
	}
	
	.sidenote-number-display {
		font-size: 0.8rem;
		color: #666666;
		font-weight: normal;
		margin-right: 0.3rem;
		vertical-align: super;
		line-height: 0;
	}
	
	sup.footnote-ref {
		font-size: 0.8rem;
		line-height: 0;
		vertical-align: super;
	}
	
	sup.footnote-ref a {
		text-decoration: none;
		color: var(--text-color);
		font-weight: normal;
		padding: 0 0.1em;
	}
	
	sup.footnote-ref a:hover {
		color: var(--text-color-link-active);
	}
	
	.footnotes {
		display: none;
	}
	
	.links-nextprev {
		width: 100%;
	}
	
	header, footer {
		width: 100%;
		padding-left: 0;
		padding-right: 0;
	}
}


@media (max-width: 1199px) {
	body {
		max-width: 680px;
		margin: 0 auto;
		padding: 2em 1.5em;
		width: auto;
	}
	
	main {
		width: 100%;
	}
	
	main p {
		width: 100%;
		max-width: 65ch;
	}
	
	main h1, main h2, main h3, main h4, main h5, main h6 {
		width: 100%;
	}
	
	.sidenote {
		display: none;
	}
	
	.footnotes {
		display: block;
		margin-top: 2rem;
		padding-top: 0;
		border-top: none;
		font-size: 0.9rem;
	}
	
	.footnotes hr {
		/* display: none; */
		display: block;
		border: none;
		border-top: 1px solid var(--color-gray-20);
		margin-bottom: 2.5rem;
	}
	
	.footnotes ol {
		padding-left: 2rem;
		margin-top: 1.5rem;	
	}
	
	.footnotes li {
		margin-bottom: 1.5rem;
	}
}

footer {
	font-size: 0.8rem;
	opacity: 0.6;
	margin-top: 4rem;
	padding-top: 2rem;
	border-top: 1px solid #e5e5e5;
}

footer a {
	text-decoration: none;
}

footer a:hover {
	color: #666666;
	text-decoration: underline;
}