:root {
	--paper-light: #fbfaf7;
	--paper-dark: #17181a;
	--ink-light: #1f2328;
	--ink-dark: #e6e3dc;
	--muted-light: #5c6370;
	--muted-dark: #a3a9b3;
	--rule-light: #d9d5cc;
	--rule-dark: #3a3d42;
	--accent-light: #8a4b12;
	--accent-dark: #e0a86a;

	--paper: var(--paper-light);
	--ink: var(--ink-light);
	--muted: var(--muted-light);
	--rule: var(--rule-light);
	--accent: var(--accent-light);

	/* Fallback for browsers without light-dark() */
	@media (prefers-color-scheme: dark) {
		--paper: var(--paper-dark);
		--ink: var(--ink-dark);
		--muted: var(--muted-dark);
		--rule: var(--rule-dark);
		--accent: var(--accent-dark);
	}

	@supports (color: light-dark(white, black)) {
		--paper: light-dark(var(--paper-light), var(--paper-dark));
		--ink: light-dark(var(--ink-light), var(--ink-dark));
		--muted: light-dark(var(--muted-light), var(--muted-dark));
		--rule: light-dark(var(--rule-light), var(--rule-dark));
		--accent: light-dark(var(--accent-light), var(--accent-dark));
	}

	color-scheme: light dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0 auto;
	padding: 1.5rem 1.25rem 4rem;
	max-width: 40rem;
	background: var(--paper);
	color: var(--ink);
	font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
	font-size: 1rem;
	line-height: 1.85;
	overflow-wrap: anywhere;
}

a {
	color: var(--accent);
	text-underline-offset: 0.2em;
}

a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

header.site {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 1.25rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--rule);
}

header.site .name {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--ink);
	text-decoration: none;
}

header.site nav {
	display: flex;
	gap: 1rem;
	font-size: 0.9rem;
}

h1 {
	margin: 2rem 0 0.5rem;
	font-size: 1.5rem;
	line-height: 1.5;
}

h2 {
	margin: 2rem 0 0.25rem;
	font-size: 1.1rem;
	line-height: 1.6;
}

.lead,
.meta,
.notice,
footer.site {
	color: var(--muted);
	font-size: 0.875rem;
}

.meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 0.9rem;
	margin: 0.25rem 0;
}

.origin {
	color: var(--accent);
}

.stories {
	margin: 0;
	padding: 0;
	list-style: none;
}

.stories > li {
	padding: 0.25rem 0 1.25rem;
	border-bottom: 1px solid var(--rule);
}

.stories h2 a {
	color: var(--ink);
}

.excerpt,
.body,
blockquote p {
	white-space: pre-wrap;
}

.excerpt {
	margin: 0.5rem 0;
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.8rem;
	color: var(--muted);
}

.tags li {
	padding: 0 0.6em;
	border: 1px solid var(--rule);
	border-radius: 999px;
}

blockquote {
	margin: 1.5rem 0;
	padding: 0.25rem 0 0.25rem 1rem;
	border-left: 3px solid var(--accent);
}

blockquote p {
	margin: 0.25rem 0;
}

blockquote footer {
	color: var(--muted);
	font-size: 0.8rem;
}

.question {
	margin: 1.25rem 0 0;
	color: var(--muted);
}

.pager {
	margin-top: 1.5rem;
}

dl.labels dt {
	margin-top: 1rem;
	font-weight: 700;
}

dl.labels dd {
	margin: 0;
}

.notice,
footer.site {
	margin-top: 2.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--rule);
}

nav.owner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.25rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--rule);
	font-size: 0.9rem;
}

form {
	margin: 0;
}

.field,
fieldset {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.25rem;
	margin: 0 0 1.5rem;
}

fieldset {
	padding: 0;
	border: 0;
}

legend {
	padding: 0;
	font-weight: 700;
}

label {
	font-weight: 700;
}

.choice {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 48px;
}

.choice label {
	font-weight: 400;
}

input[type="text"],
input[type="password"],
textarea {
	font: inherit;
	font-size: max(1rem, 1em);
	min-height: 48px;
	padding: 0.6rem 0.75rem;
	color: var(--ink);
	background: var(--paper);
	border: 1px solid var(--muted);
	border-radius: 4px;
}

textarea {
	line-height: 1.7;
	resize: vertical;
}

input[type="radio"] {
	width: 1.25rem;
	height: 1.25rem;
	accent-color: var(--accent);
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

[aria-invalid="true"] {
	border-width: 2px;
	border-color: var(--accent);
}

.hint {
	margin: 0;
	color: var(--muted);
	font-size: 0.875rem;
}

.error {
	margin: 1rem 0;
	padding: 0.75rem 1rem;
	border: 2px solid var(--accent);
	border-radius: 4px;
	font-weight: 700;
}

.error::before {
	content: "入力を直してください: ";
}

button {
	font: inherit;
	font-size: max(1rem, 1em);
	min-height: 48px;
	padding: 0.5rem 1.25rem;
	color: var(--paper);
	background: var(--ink);
	border: 1px solid var(--ink);
	border-radius: 4px;
	cursor: pointer;
}

button.secondary {
	color: var(--ink);
	background: transparent;
}

button.plain {
	min-height: 0;
	padding: 0;
	color: var(--accent);
	background: none;
	border: 0;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 2rem;
}

.preview {
	margin-top: 1.5rem;
	padding: 0.25rem 1.25rem 1rem;
	border: 1px solid var(--rule);
	border-radius: 4px;
}
