:root {
  --bg: #faf7f1;
  --text: #1c1814;
  --muted: #7a716a;
  --border: #e6dfd2;
  --accent: #c14a1c;
  --hover: rgba(28, 24, 20, 0.05);
  --code-bg: #ede5d4;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root.dark {
  --bg: #0e0c0a;
  --text: #ece6dc;
  --muted: #8d847a;
  --border: #2a2520;
  --accent: #f4926a;
  --hover: rgba(236, 230, 220, 0.06);
  --code-bg: #1b1612;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 5rem;
}

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

/* Header */
header.site {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}
header.site .site-name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  margin: 0;
}
header.site .site-name a {
  color: var(--text);
}
header.site .site-name a:hover {
  color: var(--accent);
  text-decoration: none;
}
header.site nav {
  display: flex;
  gap: 1.1rem;
  align-items: center;
}
header.site nav a {
  color: var(--muted);
  font-size: 0.95rem;
}
header.site nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
  line-height: 1;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline; }
:root.dark .theme-toggle .sun { display: inline; }
:root.dark .theme-toggle .moon { display: none; }

/* Landing hero */
.intro {
  margin: 0 0 2.5rem;
}
.intro h1 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 0.9rem;
}
.intro h1 .period {
  color: var(--accent);
}
.intro p {
  color: var(--muted);
  margin: 0;
  font-size: 1.08rem;
  max-width: 32em;
}

/* Section labels */
.section-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.5rem 0 0.4rem;
}

/* Link list */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.link-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.8rem;
  margin: 0 -0.8rem;
  color: var(--text);
  min-height: 44px;
  border-radius: 8px;
}
.link-list a:hover {
  background: var(--hover);
  text-decoration: none;
}
.link-list .label {
  font-weight: 500;
}
.link-list .desc {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
  flex-shrink: 1;
}
.link-list a::after {
  content: "→";
  color: var(--accent);
  margin-left: 0.4rem;
  flex-shrink: 0;
}

/* Blog list */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0.8rem;
  margin: 0 -0.8rem;
  color: var(--text);
  border-radius: 8px;
}
.post-list a:hover {
  background: var(--hover);
  text-decoration: none;
}
.post-list .post-title {
  font-size: 1.1rem;
  font-weight: 500;
}
.post-list time {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Blog post */
.post-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 2rem;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
article.post {
  font-size: 1.1rem;
  line-height: 1.7;
}
article.post h1 {
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 0 0 0.5rem;
}
article.post h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.5rem 0 0.8rem;
  letter-spacing: -0.015em;
}
article.post h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.6rem;
}
article.post p {
  margin: 0 0 1.2rem;
}
article.post a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
}
article.post a:hover {
  color: var(--accent);
}
article.post ul, article.post ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
}
article.post li { margin: 0.3rem 0; }
article.post li::marker { color: var(--accent); }
article.post blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1.2rem;
  color: var(--muted);
}
article.post code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.38em;
  border-radius: 4px;
}
article.post pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
  font-family: var(--mono);
}
article.post pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}
article.post hr {
  border: none;
  text-align: center;
  margin: 2.5rem 0;
  height: 1.2rem;
  position: relative;
}
article.post hr::before {
  content: "· · ·";
  color: var(--accent);
  font-size: 1.2rem;
  letter-spacing: 0.3em;
  font-family: var(--sans);
}
article.post img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
}
article.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
article.post th, article.post td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
article.post th { font-weight: 600; }

/* Footer */
footer.site {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--accent); text-decoration: none; }

/* Small mobile */
@media (max-width: 480px) {
  body { font-size: 16px; }
  .container { padding: 1.25rem 1.25rem 4rem; }
  header.site { margin-bottom: 2rem; }
  .intro h1 { font-size: 2rem; }
  article.post h1 { font-size: 1.85rem; }
  article.post { font-size: 1.05rem; }
  .link-list .desc { display: none; }
}

/* Desktop */
@media (min-width: 720px) {
  .container {
    max-width: 760px;
    padding: 2.5rem 2rem 6rem;
  }
  header.site {
    margin-bottom: 3rem;
  }
  header.site .site-name {
    font-size: 1.25rem;
  }
  .intro {
    margin: 0 0 3rem;
  }
  .intro h1 {
    font-size: 3.2rem;
  }
  .intro p {
    font-size: 1.18rem;
  }
  .section-label {
    margin-top: 3rem;
    font-size: 0.78rem;
  }
  .link-list a {
    padding: 0.85rem 0.9rem;
    margin: 0 -0.9rem;
  }
  .link-list .label {
    font-size: 1.04rem;
  }
  .post-list a {
    padding: 0.9rem 0.9rem;
    margin: 0 -0.9rem;
  }
  .post-list .post-title {
    font-size: 1.18rem;
  }
  article.post {
    font-size: 1.16rem;
    line-height: 1.75;
  }
  article.post h1 {
    font-size: 2.9rem;
  }
  article.post h2 {
    font-size: 1.7rem;
    margin: 3rem 0 0.9rem;
  }
  .post-meta {
    margin-bottom: 2.5rem;
  }
  footer.site {
    margin-top: 5rem;
  }
}

/* Wide */
@media (min-width: 1100px) {
  .container {
    max-width: 820px;
    padding: 3rem 2rem 7rem;
  }
  .intro h1 { font-size: 3.8rem; }
  article.post h1 { font-size: 3.3rem; }
  article.post h2 { font-size: 1.8rem; }
}

/* Hover-only effects */
@media (hover: hover) {
  .link-list a, .post-list a {
    transition: background 0.15s ease, color 0.15s ease;
  }
  .link-list a::after {
    transition: transform 0.2s ease;
  }
  .link-list a:hover::after {
    transform: translateX(3px);
  }
  header.site nav a, footer.site a, .theme-toggle {
    transition: color 0.15s ease, border-color 0.15s ease;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
