:root {
  --page-width: 48rem;
  --wide-width: 64rem;

  --background: #ffffff;
  --surface: #f4f4f4;
  --foreground: #202020;
  --muted: #666666;
  --border: #dddddd;
  --link: #174ea6;

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--foreground);
  background: var(--background);
  line-height: 1.65;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

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

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

a:hover {
  text-decoration-thickness: 0.14em;
}

.container {
  width: min(100% - 2rem, var(--page-width));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

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

.main-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.main-navigation a {
  color: var(--foreground);
}

main {
  flex: 1;
  padding-block: 3rem;
}

.site-footer {
  margin-top: 4rem;
  padding-block: 2rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

.hero {
  margin-bottom: 4rem;
}

.hero h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.1;
}

.hero-description {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.2rem;
}

.page-header {
  margin-bottom: 3rem;
}

.page-header h1,
.post-header h1 {
  margin-bottom: 0.5rem;
  line-height: 1.15;
}

.page-header > p,
.post-description {
  color: var(--muted);
  font-size: 1.1rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-list {
  display: grid;
}

.post-summary {
  padding-block: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-summary-title {
  margin: 0;
  line-height: 1.25;
}

.post-summary-title a {
  color: var(--foreground);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.read-more {
  font-weight: 600;
}

.post-header {
  margin-bottom: 3rem;
}

.post-content,
.page-content {
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size: 1.08rem;
}

.post-content h2,
.post-content h3,
.page-content h2,
.page-content h3 {
  margin-top: 2.5em;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.25;
}

.post-content pre,
.page-content pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface);
  font-size: 0.9rem;
}

.post-content code,
.page-content code {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}

.post-content :not(pre) > code,
.page-content :not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 0.2rem;
  background: var(--surface);
}

.post-content blockquote,
.page-content blockquote {
  margin-inline: 0;
  padding-left: 1rem;
  color: var(--muted);
  border-left: 0.25rem solid var(--border);
}

.table-of-contents {
  margin-block: 2rem 3rem;
  padding: 1rem 1.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.table-of-contents h2 {
  margin-top: 0;
  font-size: 1rem;
}

.table-of-contents ol {
  margin-bottom: 0;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
}

.pagination-side-right {
  text-align: right;
}

.pagination-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-navigation a {
  display: flex;
  flex-direction: column;
}

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

.post-navigation-label {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.archive-year {
  margin-bottom: 3rem;
}

.archive-list {
  padding: 0;
  list-style: none;
}

.archive-list li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.archive-list time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.error-page {
  padding-block: 4rem;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--muted);
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 40rem) {
  .header-inner {
    padding-block: 1rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .pagination {
    grid-template-columns: 1fr 1fr;
  }

  .pagination-status {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-navigation-next {
    text-align: left;
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #151515;
    --surface: #242424;
    --foreground: #eeeeee;
    --muted: #aaaaaa;
    --border: #3d3d3d;
    --link: #8ab4f8;
  }
}

.about-page {
  max-width: 42rem;
}

.page-description {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.about-page .page-content {
  margin-top: 2.5rem;
}
