:root {
  --bg: #f6f3eb;
  --surface: #fffdf8;
  --surface-2: #f2ede3;
  --text: #1f2328;
  --text-soft: #5f6773;
  --heading: #111418;
  --link: #0b57d0;
  --link-hover: #0842a0;
  --border: #ddd5c7;
  --blockquote-border: #cbbda3;
  --code-bg: #f3efe6;
  --selection: #dbe8ff;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.05);

  --content-width: 66ch;
  --list-width: 92ch;
  --radius: 14px;

  --font-body: Georgia, "Times New Roman", Times, serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --surface: #171a1d;
    --surface-2: #1d2126;
    --text: #e8e5df;
    --text-soft: #aab2bc;
    --heading: #f5f3ef;
    --link: #8bb8ff;
    --link-hover: #b3d0ff;
    --border: #2c3238;
    --blockquote-border: #586474;
    --code-bg: #1f2429;
    --selection: #20324d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-link {
  color: var(--heading);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-link:hover {
  color: var(--link);
}

/* Main layout */

.wrap {
  max-width: 90%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--heading);
  font-family: var(--font-ui);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 2.2rem 0 1.4rem;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  margin-top: 0;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

h4,
h5,
h6 {
  font-size: 1rem;
}

p,
ul,
ol,
blockquote,
pre,
table {
  margin: 0 0 1.35rem;
}

p,
li {
  font-size: 1.125rem;
}

small {
  font-family: var(--font-ui);
  color: var(--text-soft);
}

strong {
  color: var(--heading);
}

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

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 0.14em;
}

/* Content width for article pages */

main > h1 {
  max-width: min(72ch, 100%);
}

main > ul,
main > ol {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 0.45rem;
}

main > p + h2,
main > ul + h2,
main > ol + h2,
main > blockquote + h2 {
  margin-top: 3rem;
}

.lead {
  max-width: var(--list-width);
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--text-soft);
}

/* Post listing */

.post-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.post-list li {
  margin: 0;
  padding: 1.6rem 1.6rem 1.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.post-title-link {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--heading);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.post-title-link:hover {
  color: var(--link);
}

.post-date {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
  text-align: right;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text-soft);
  padding-top: 0.15rem;
}

.post-list li p {
  margin: 1rem 0 0;
  max-width: 64ch;
  color: var(--text-soft);
  font-size: 1.04rem;
  line-height: 1.7;
}

.post-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.1rem;
}

.read-more {
  display: inline-block;
  width: fit-content;
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
}

.read-more:hover {
  color: var(--link-hover);
}

/* Article styles */

.post-meta {
  max-width: var(--content-width);
  margin: 0 auto 2rem;
  font-family: var(--font-ui);
  color: var(--text-soft);
  font-size: 0.95rem;
}

blockquote {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 4px solid var(--blockquote-border);
  color: var(--text-soft);
  font-style: italic;
}

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

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

code {
  background: var(--code-bg);
  padding: 0.16rem 0.38rem;
  border-radius: 6px;
}

pre {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  line-height: 1.55;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  display: block;
  overflow-x: auto;
}

th,
td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 1rem;
}

th {
  font-family: var(--font-ui);
  color: var(--heading);
}

/* Pagination */

.pagination {
  max-width: var(--list-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-ui);
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  color: var(--heading);
  text-decoration: none;
  font-size: 0.95rem;
}

.pagination a:hover {
  color: var(--link);
  border-color: color-mix(in srgb, var(--link) 35%, var(--border));
}

/* Footer */

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

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  font-family: var(--font-ui);
  color: var(--text-soft);
  font-size: 0.95rem;
}

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

/* Responsive */

@media (max-width: 700px) {
  body {
    line-height: 1.7;
  }

  .wrap {
    padding: 1.5rem 1rem 3rem;
  }

  .site-header-inner {
    padding: 0.9rem 1rem;
  }

  p,
  li {
    font-size: 1.05rem;
  }

  h1 {
    font-size: 2.15rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .post-list {
    max-width: 100%;
    gap: 1rem;
  }

  .post-list li {
    padding: 1.15rem 1rem 1.05rem;
  }

  .post-row {
    display: block;
  }

  .post-title-link {
    display: block;
    font-size: 1.18rem;
  }

  .post-date {
    margin-top: 0.45rem;
    text-align: left;
    white-space: normal;
  }

  .post-list li p {
    margin-top: 0.8rem;
    font-size: 1rem;
  }

  .post-footer {
    justify-content: flex-end;
    margin-top: 0.9rem;
  }

  .read-more {
    margin-left: auto;
  }

  .pagination {
    align-items: stretch;
  }

  .pagination a,
  .pagination span {
    width: 100%;
    text-align: center;
  }
}

.page-intro,
.contact-card {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.contact-card {
  margin-top: 1.5rem;
  padding: 1.4rem 1.4rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.contact-card h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.contact-card p:last-child {
  margin-bottom: 0;
}