:root {
  color-scheme: light dark;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #d8d8d2;
  --accent: #202020;
  --code-bg: #ecece7;
  --max-width: 920px;
  --article-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #181818;
    --text: #ededed;
    --muted: #a0a0a0;
    --line: #343434;
    --accent: #ffffff;
    --code-bg: #222222;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.site-header__inner,
.site-footer__inner,
.content {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header__inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.92rem;
}

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

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

.content {
  flex: 1;
  padding-block: 64px 80px;
}

.content--article {
  width: min(calc(100% - 40px), var(--article-width));
}

.content--narrow {
  width: min(calc(100% - 40px), 640px);
}

.page-heading {
  margin-bottom: 36px;
}

.page-heading h1,
.article__header h1,
.not-found h1 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.page-heading h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-list {
  display: grid;
  gap: 26px;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.post-card__cover {
  min-height: 190px;
  background: #171717;
}

.post-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card__body {
  padding: 26px;
}

.post-card h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.2;
}

.post-card h2 a {
  text-decoration: none;
}

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

.post-card__excerpt > :first-child {
  margin-top: 0;
}

.post-card__excerpt > :last-child {
  margin-bottom: 0;
}

.read-more {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.9rem;
  font-weight: 650;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

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

.pagination__next {
  text-align: right;
}

.article__header {
  margin-bottom: 42px;
}

.article__header h1 {
  font-size: clamp(2.2rem, 6vw, 4.2rem);
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.article__category {
  margin-top: 18px;
}

.article__category a,
.article__tags a {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  text-decoration: none;
  font-size: 0.82rem;
}

.article__body {
  font-size: 1.04rem;
}

.article__body h2,
.article__body h3,
.article__body h4 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  line-height: 1.25;
}

.article__body p,
.article__body ul,
.article__body ol,
.article__body blockquote,
.article__body pre,
.article__body table {
  margin-block: 1.1em;
}

.article__body blockquote {
  margin-inline: 0;
  padding-left: 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.article__body pre {
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code-bg);
  line-height: 1.5;
}

.article__body code {
  padding: 0.12em 0.3em;
  border-radius: 4px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.article__body pre code {
  padding: 0;
  background: transparent;
}

.article__body table {
  width: 100%;
  border-collapse: collapse;
}

.article__body th,
.article__body td {
  padding: 9px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.article__body hr {
  margin-block: 2.4em;
  border: 0;
  border-top: 1px solid var(--line);
}

.article__body img {
  margin-inline: auto;
  border-radius: 8px;
}

.article__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.search-form {
  margin-bottom: 24px;
}

.search-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 650;
}

.search-form__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-form input,
.search-form button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.search-form input {
  min-width: 0;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
}

.search-form button {
  padding: 0 18px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}

.search-status {
  min-height: 1.5em;
  color: var(--muted);
}

.search-results {
  display: grid;
  gap: 16px;
}

.search-result {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.search-result h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.search-result h2 a {
  text-decoration: none;
}

.search-result p {
  margin: 0;
  color: var(--muted);
}

.not-found {
  padding-block: 40px;
}

.not-found h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
}

.button-link {
  display: inline-block;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
}

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

.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  padding-block: 24px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 680px) {
  .site-header__inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding-block: 18px;
  }

  .site-nav {
    gap: 14px;
  }

  .content {
    padding-block: 42px 64px;
  }

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

  .post-card__cover {
    min-height: 180px;
    aspect-ratio: 16 / 9;
  }

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

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

  .search-form__row {
    grid-template-columns: 1fr;
  }
}
