:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #6a737d;
  --line: #e6e8eb;
  --accent: #0092c4;
  --accent-dark: #00749c;
  --code-bg: #f5f6f8;
  --page: 1000px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --text: #e6e8eb;
    --muted: #9aa4af;
    --line: #262b31;
    --accent: #35b6e0;
    --accent-dark: #6cc7e6;
    --code-bg: #1a1f25;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.site-header {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: 0.95rem;
}

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

.site-nav a[aria-current="page"] {
  color: var(--accent-dark);
  font-weight: 600;
}

.site-main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3.5rem;
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 3.5rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 1.5rem;
}

.widget-title {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.category-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.category-list li + li {
  margin-top: 0.45rem;
}

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

.category-list a:hover {
  color: var(--accent-dark);
}

.category-list .current a {
  color: var(--accent-dark);
  font-weight: 600;
}

.site-footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0 0 0.6rem;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Home */
.home-intro {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.portrait {
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--line);
}

.teaser {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.teaser strong {
  color: var(--text);
}

.teaser span {
  color: var(--accent-dark);
  font-weight: 600;
}

/* Article */
.article-header {
  margin-bottom: 2rem;
}

.article-header h1,
.archive-header h1,
.notfound h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

.meta span + span::before {
  content: "\00b7";
  margin: 0 0.5rem;
  color: var(--line);
}

.prose {
  font-size: 1.02rem;
}

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

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.prose p,
.prose ul,
.prose ol,
.prose figure,
.prose iframe,
.prose blockquote {
  margin: 1.15rem 0;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose img {
  display: block;
  border-radius: 6px;
}

.prose figure {
  margin: 1.5rem 0;
}

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.prose blockquote {
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.prose :not(pre) > code {
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.prose iframe {
  max-width: 100%;
  border: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

/* Pager */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.pager-next {
  margin-left: auto;
  text-align: right;
}

/* Archive */
.archive-header {
  margin-bottom: 2rem;
}

.archive-header p {
  margin: 0;
  color: var(--muted);
}

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

.post-list-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}

.post-list-item h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.post-list-item h2 a {
  color: var(--text);
}

.excerpt {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 800px) {
  .archive-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: static;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
  }

  .category-list {
    columns: 2;
    column-gap: 1.5rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .home-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .portrait {
    width: 104px;
    height: 104px;
  }

  .teaser {
    font-size: 1.3rem;
  }
}
