:root {
  --bg: #fdfbf7;
  --bg-alt: #f4f0e8;
  --ink: #2b2620;
  --ink-soft: #6b6259;
  --ink-mute: #9d958a;
  --accent: #d97a5c;
  --accent-soft: #fbe6db;
  --border: #e8e0d4;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --max-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

header.site {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

header.site .wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header.site .brand {
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

header.site .brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
}

@media (max-width: 600px) {
  header.site .brand span {
    font-size: 14px;
  }
  header.site .brand img {
    width: 28px;
    height: 28px;
  }
}

header.site nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

header.site nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

header.site nav a:hover,
header.site nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 80px;
}

h1 {
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 22px;
  margin: 40px 0 12px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--ink);
}

p,
li {
  color: var(--ink);
}

ul,
ol {
  padding-left: 22px;
}

li {
  margin: 4px 0;
}

a {
  color: var(--accent);
}

.kicker {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.updated {
  color: var(--ink-mute);
  font-size: 13px;
  margin: 0 0 32px;
}

.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin: 24px 0 40px;
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc a {
  text-decoration: none;
  color: var(--ink);
}

.toc a:hover {
  color: var(--accent);
}

article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}

article section {
  scroll-margin-top: 80px;
}

.callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 15px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 6px;
  color: var(--accent);
}

.card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

footer.site {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
}

footer.site a {
  color: var(--ink-soft);
  margin: 0 6px;
}

#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 600px) {
  h1 {
    font-size: 26px;
  }
  article {
    padding: 20px 18px;
  }
  header.site nav {
    gap: 6px;
  }
  header.site nav a {
    font-size: 12px;
    padding: 5px 8px;
  }
}
