:root {
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --bg-light: #fdf7ec;
  --bg-dark: #0f1419;
  --text-light: #1a1814;
  --text-dark: #f8f5ef;
  --muted-light: #6f685f;
  --muted-dark: #c6bcae;
  --accent: #5f9b71;
  --border-light: #e4ddcf;
  --border-dark: rgba(248, 245, 239, 0.16);
  --shadow-light: rgba(40, 30, 15, 0.07);
  --shadow-dark: rgba(0, 0, 0, 0.28);
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg-light);
  color: var(--text-light);
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

body[data-theme='dark'] {
  background: var(--bg-dark);
  color: var(--text-dark);
}

body[data-theme='dark'] hr.section-separator {
  border-color: var(--border-dark);
}

body[data-theme='dark'] a {
  color: inherit;
}

body[data-theme='dark'] a:hover,
body[data-theme='dark'] a:focus-visible {
  color: var(--accent);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 120px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0.01em;
  font-weight: 500;
}

.site-title {
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 20px;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  font-weight: 400;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

#theme-toggle {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 249, 242, 0.92);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

#theme-toggle::after {
  content: '';
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f9b71' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.3'/%3E%3Cpath d='M12 3.2v2.4M12 18.4v2.4M3.2 12h2.4M18.4 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7'/%3E%3C/svg%3E");
}

body[data-theme='dark'] #theme-toggle {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(18, 22, 26, 0.74);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

body[data-theme='dark'] #theme-toggle::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d7efdd' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.4 14.4A7.5 7.5 0 0 1 9.6 3.6 6.2 6.2 0 0 0 14.4 21a7.7 7.7 0 0 0 6-6.6z'/%3E%3C/svg%3E");
}

#theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -18px rgba(40, 30, 15, 0.5);
}

#theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(95, 155, 113, 0.28);
}

body[data-theme='dark'] #theme-toggle:hover {
  box-shadow: 0 10px 20px -18px rgba(0, 0, 0, 0.65);
}

.section-title {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--muted-light);
  margin-bottom: 18px;
  font-weight: 500;
}

body[data-theme='dark'] .section-title {
  color: var(--muted-dark);
}

.latest {
  margin-bottom: 48px;
}

.latest-card {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-theme='dark'] .latest-card {
  background: transparent;
  box-shadow: none;
}

.latest-title {
  font-size: 28px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-light);
  text-decoration: none;
}

body[data-theme='dark'] .latest-title {
  color: var(--text-dark);
}

.latest-title:hover,
.latest-title:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.latest-card .meta {
  margin: 12px 0 14px;
  color: var(--muted-light);
  font-size: 15px;
  font-weight: 400;
}

body[data-theme='dark'] .latest-card .meta {
  color: var(--muted-dark);
}

.latest-card .summary {
  margin: 0 0 18px;
  color: inherit;
  font-weight: 400;
}

.latest-card .cta {
  font-size: 14px;
  letter-spacing: 0.1em;
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  text-transform: none;
}

.latest-card .cta:hover,
.latest-card .cta:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.section-separator {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 52px 0;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  max-width: 600px;
  font-size: 15px;
}

.topic {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  font-weight: 400;
}

.topic:hover,
.topic:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

body[data-theme='dark'] .topic:hover,
body[data-theme='dark'] .topic:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.post-item {
  display: flex;
  gap: 16px;
  font-size: 15px;
  align-items: baseline;
  font-weight: 400;
}

.post-item.empty {
  font-style: italic;
  color: var(--muted-light);
  font-weight: 400;
}

.post-date {
  min-width: 96px;
  color: var(--muted-light);
  letter-spacing: 0.08em;
  font-weight: 400;
}

body[data-theme='dark'] .post-date,
body[data-theme='dark'] .post-item.empty {
  color: var(--muted-dark);
}

.post-item a {
  color: var(--text-light);
  text-decoration: none;
}

body[data-theme='dark'] .post-item a {
  color: var(--text-dark);
}

.post-item a:hover,
.post-item a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.empty {
  font-family: var(--font-sans);
  color: var(--muted-light);
}

body[data-theme='dark'] .empty {
  color: var(--muted-dark);
}

.post {
  margin-top: 24px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-theme='dark'] .post {
  background: transparent;
  box-shadow: none;
}

.post-title {
  font-size: 38px;
  margin: 0 0 12px;
  font-weight: 500;
}

.post-submeta {
  margin: 0 0 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--muted-light);
}

body[data-theme='dark'] .post-submeta {
  color: var(--muted-dark);
}

.post-summary {
  margin: 0 0 26px;
  color: inherit;
  font-style: italic;
  font-weight: 400;
  max-width: 560px;
}

.post-content p {
  margin: 18px 0;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 40px;
  margin-bottom: 12px;
}

.post-content code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

body[data-theme='dark'] .post-content code {
  background: rgba(255, 255, 255, 0.08);
}

.post-content pre {
  background: rgba(0, 0, 0, 0.04);
  padding: 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
}

body[data-theme='dark'] .post-content pre {
  background: rgba(255, 255, 255, 0.06);
}

.post-content blockquote {
  border-left: 3px solid var(--border-light);
  margin: 24px 0;
  padding-left: 18px;
  color: var(--muted-light);
  font-style: italic;
}

body[data-theme='dark'] .post-content blockquote {
  border-color: var(--border-dark);
  color: var(--muted-dark);
}

.post-content ul,
.post-content ol {
  margin: 18px 0 18px 24px;
  padding-left: 18px;
}

.post-content li {
  margin: 8px 0;
}

.post-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.post-content a:hover,
.post-content a:focus-visible {
  color: var(--accent);
}

.page {
  padding: 0;
  margin-top: 32px;
}

body[data-theme='dark'] .page {
  background: transparent;
  box-shadow: none;
}

.page-header {
  margin-bottom: 16px;
}

.page-title {
  font-size: 34px;
  margin: 0 0 12px;
  font-weight: 500;
}

.page-summary {
  margin: 0;
  color: var(--muted-light);
  font-weight: 400;
}

body[data-theme='dark'] .page-summary {
  color: var(--muted-dark);
}

.page-summary:empty {
  display: none;
}

.page-content p {
  margin: 18px 0;
}

.page-content a {
  color: inherit;
  text-decoration: underline;
}

.tag-page .post-list {
  margin-top: 28px;
}

@media (max-width: 600px) {
  .container {
    padding: 48px 20px 96px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .site-nav {
    gap: 12px;
  }

  .latest-card {
    padding: 20px;
    border-radius: 16px;
  }

  .post,
  .page {
    padding: 24px;
    border-radius: 20px;
  }

  .post-title {
    font-size: 32px;
  }

  .post-item {
    flex-direction: column;
    gap: 4px;
  }

  .post-date {
    min-width: auto;
  }
}
