html {
  color-scheme: light dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 680px;
  padding: 2.5rem 1.5rem 5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: #111;
  background: #fff;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  display: block;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
}

header {
  margin-bottom: 3rem;
  font-size: 0.875rem;
}

a {
  color: #111;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-underline-offset 0.15s ease;
}

a:visited {
  color: #555;
}

a:hover {
  color: #6b8cba;
  text-underline-offset: 6px;
}

a:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
  border-radius: 2px;
}

header a:visited {
  color: #111;
}

header a {
  text-decoration: none;
  font-weight: 600;
}

header a:hover {
  text-decoration: underline;
}

header a[aria-current="page"] {
  text-decoration: underline;
}

@keyframes h1-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

h1 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  animation: h1-appear 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  h1 {
    animation: none;
  }

  .post-list li {
    transition: none;
  }
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2.25rem 0 0.625rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

li {
  margin-bottom: 0.35rem;
}

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

time {
  color: #666;
  font-size: 0.875rem;
}

.post-meta {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid #6b8cba;
  color: #555;
  background: rgba(107, 140, 186, 0.07);
  border-radius: 0 3px 3px 0;
}

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

hr {
  border: none;
  margin: 2.5rem 0;
  text-align: center;
  color: #ccc;
  cursor: default;
}

hr::before {
  content: "* * *";
  display: inline-block;
  letter-spacing: 0.5em;
  font-size: 0.875rem;
  transition: letter-spacing 0.4s ease;
}

hr:hover::before {
  letter-spacing: 1em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 0 0 1rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e5e5;
  text-align: left;
}

th {
  background: #f7f7f7;
  font-weight: 600;
}

.post-reading-time {
  color: #888;
  font-size: 0.875rem;
}

.post-reading-time::before {
  content: "·";
  margin-right: 0.6rem;
}

code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: #f2f2f2;
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

pre {
  background: #f2f2f2;
  border-radius: 4px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 0 0 1rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

.post-list {
  list-style: none;
  padding-left: 0;
}

.post-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: baseline;
  margin-bottom: 1rem;
  transition: padding-left 0.2s ease;
}

.post-list li:hover {
  padding-left: 0.5rem;
}

.post-list-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: baseline;
  width: 100%;
  margin-top: 0.25rem;
}

.post-list-desc {
  width: 100%;
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
}

.post-list time {
  flex-shrink: 0;
  min-width: 7.5rem;
}

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e5e5;
  font-size: 0.8125rem;
  color: #999;
}

footer a {
  color: #999;
}

footer a:visited {
  color: #999;
}

::selection {
  background: #ffe08a;
  color: #111;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e5e5;
  font-size: 0.875rem;
  gap: 1.5rem;
}

.post-nav-next {
  text-align: right;
}

.post-nav-dir {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 0.2rem;
}

.post-nav-date {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.15rem;
}

.post-tags {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.15em 0.5em;
  background: #f2f2f2;
  border-radius: 3px;
  font-size: 0.8125rem;
  text-decoration: none;
  color: #555;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tag:hover {
  background: #e5e5e5;
  color: #111;
  transform: translateY(-1px);
}

.tag-count {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.tag-index-list {
  list-style: none;
  padding-left: 0;
}

.tag-index-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.tag-index-link {
  font-weight: 500;
}

.tag-index-count {
  color: #666;
  font-size: 0.875rem;
}

.feed-badge {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.feed-badge img {
  display: block;
  opacity: 0.7;
}

.feed-badge img:hover {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  body {
    color: #ddd;
    background: #0f0f0f;
  }

  a {
    color: #ddd;
  }

  a:visited {
    color: #999;
  }

  a:hover {
    color: #8aabcf;
  }

  header a:visited {
    color: #ddd;
  }

  footer a:visited {
    color: #888;
  }

  a:focus-visible {
    outline-color: #ddd;
  }

  blockquote {
    border-left-color: #4d7aab;
    color: #999;
    background: rgba(77, 122, 171, 0.1);
  }

  hr {
    color: #555;
  }

  th {
    background: #1a1a1a;
  }

  th,
  td {
    border-color: #2a2a2a;
  }

  code {
    background: #1e1e1e;
    color: #ddd;
  }

  pre {
    background: #1e1e1e;
  }

  footer {
    border-top-color: #2a2a2a;
    color: #888;
  }

  footer a {
    color: #888;
  }

  .post-nav {
    border-top-color: #2a2a2a;
  }

  .post-nav-dir {
    color: #888;
  }

  .post-nav-date {
    color: #888;
  }

  .tag {
    background: #282828;
    color: #aaa;
  }

  .tag:hover {
    background: #363636;
    color: #ddd;
  }

  .feed-badge img {
    opacity: 0.4;
  }

  .feed-badge img:hover {
    opacity: 0.7;
  }

  .tag-count {
    color: #888;
  }

  .tag-index-count {
    color: #888;
  }

  .post-list-desc {
    color: #888;
  }

  time {
    color: #888;
  }

  .post-reading-time {
    color: #888;
  }

  ::selection {
    background: #3d3000;
    color: #ddd;
  }
}
