:root {
  --content-max: 72ch;
  --gutter: clamp(16px, 4vw, 30px);
  --stack: 22px;

  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Constantia, Georgia, Cambria, "Times New Roman", Times, ui-serif, serif;
  --font-ui: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;

  --base-font-size: 18px;
  --line-height: 1.65;

  --header-pad: 30px;
  --post-pad: 30px;
  --main-pad-top: 18px;
  --main-pad-bottom: 40px;

  --bg: #fbfbfb;
  --surface: #ffffff;
  --text: #121212;
  --muted: #5b5b5b;
  --faint: #7a7a7a;
  --border: #e6e6e6;
  --link: #1a4fd7;
  --link-visited: #5a33a8;
  --code-bg: #f3f4f6;
  --selection: #dbeafe;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0c0d0f;
    --surface: #121419;
    --text: #f2f2f2;
    --muted: #b6b6b6;
    --faint: #8f8f8f;
    --border: #2a2f39;
    --link: #7aa2ff;
    --link-visited: #c0a6ff;
    --code-bg: #151821;
    --selection: #1f2a44;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0d0f;
  --surface: #121419;
  --text: #f2f2f2;
  --muted: #b6b6b6;
  --faint: #8f8f8f;
  --border: #2a2f39;
  --link: #7aa2ff;
  --link-visited: #c0a6ff;
  --code-bg: #151821;
  --selection: #1f2a44;
}

html {
  color-scheme: light dark;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

::selection {
  background: var(--selection);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--base-font-size);
  line-height: var(--line-height);
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

a:visited {
  color: var(--link-visited);
}

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

.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(-120%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin: 12px;
  border-radius: 10px;
  z-index: 10;
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--header-pad) 0;
  border-bottom: 1px solid var(--border);
}

.site-title a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.wordmark-zero {
  position: relative;
  top: -0.18em;
  font-size: 0.88em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-ui);
  font-size: 0.95em;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
}

.theme-toggle {
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle__icon--sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

html[data-theme="light"] .theme-toggle__icon--moon {
  display: block;
}

html[data-theme="light"] .theme-toggle__icon--sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle__icon--sun {
    display: block;
  }

  html:not([data-theme]) .theme-toggle__icon--moon {
    display: none;
  }
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"],
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

main {
  padding: var(--main-pad-top) 0 var(--main-pad-bottom);
}

.post {
  padding: var(--post-pad) 0;
  border-bottom: 1px solid var(--border);
}

.post:last-of-type {
  border-bottom: 0;
}

.post-title {
  margin: 10px 0 0;
  font-size: 1.25em;
  line-height: 1.25;
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a:hover,
.post-title a:focus-visible {
  text-decoration: underline;
}

.post-meta {
  font-size: 0.85em;
  color: var(--faint);
  font-family: var(--font-ui);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.post-meta a {
  color: inherit;
}

.post-meta--bottom {
  margin-top: 16px;
}

.post-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: 0.92em;
}

.post-navigation a {
  color: var(--muted);
}

.post-navigation a:hover,
.post-navigation a:focus-visible {
  color: var(--text);
}

.post-source {
  margin: 10px 0 0;
  font-size: 0.95em;
}

.link-preview {
  margin-top: 12px;
}

.link-preview__link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.link-preview__title {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.link-preview__site {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9em;
}

.link-preview__desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview__img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.post-tags a {
  margin-right: 10px;
}

.prose {
  margin-top: 12px;
}

.prose p {
  margin: 0.95em 0;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.25;
  margin: 1.2em 0 0.5em;
}

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

.prose code {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.prose pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
}

.prose pre code {
  font-size: 0.9em;
}

.page-title {
  margin: 0.6em 0 0;
  font-size: 1.6em;
  line-height: 1.15;
}

.muted {
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0;
  font-family: var(--font-ui);
}

.pagination a {
  color: var(--text);
}

.site-footer {
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
  font-size: 0.95em;
}

.footer-links a {
  margin-right: 14px;
}

.tag-index__list {
  margin: 0.2em 0 1.4em;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-family: var(--font-ui);
  font-size: 0.95em;
}

.tag-index__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.tag-index__tag {
  text-decoration: none;
  color: var(--muted);
}

.tag-index__tag:hover,
.tag-index__tag:focus-visible {
  text-decoration: underline;
  color: var(--text);
}

.tag-index__count {
  font-size: 0.9em;
  color: var(--faint);
}

.list {
  margin-top: 16px;
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 0.4em 0;
}

.archive-month {
  margin: 1.4em 0 0.4em;
  font-size: 1.1em;
}

.archive-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1em;
}

.archive-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0.4em 0;
}

.comments {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.comments-flash {
  margin: 12px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.comments-flash p {
  margin: 0;
}

.comments-flash p + p {
  margin-top: 6px;
}

.comment-list {
  margin: 14px 0 22px;
}

.comment {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9em;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-body {
  margin-top: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form {
  margin-top: 18px;
}

.comment-form__row {
  margin: 12px 0;
}

.comment-form label {
  display: block;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.95em;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
}

.comment-form textarea {
  resize: vertical;
}

.comment-form button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.comment-form button:hover {
  border-color: var(--faint);
}

.comment-form__hp {
  display: none;
}

.comment-report {
  margin-top: 10px;
}

.comment-report__btn {
  font: inherit;
  font-size: 0.9em;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  cursor: pointer;
}

.comment-report__details {
  margin-top: 8px;
}

.comment-report__details summary {
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.9em;
}

.comment-report__reason {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9em;
}

.comment-report__reason textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  resize: vertical;
}

@media (max-width: 520px) {
  :root {
    --base-font-size: 17px;
  }

  .site-nav {
    gap: 10px;
  }
}
