/* Reset + Apple-style base typography */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

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

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

.container {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 28px 140px;
}
.container.narrow { max-width: var(--narrow-w); }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.022em;
  margin: 0;
}
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: 1.7rem; margin-top: 2.2em; margin-bottom: 0.4em; }
h3 { font-size: 1.3rem; margin-top: 1.6em; margin-bottom: 0.3em; }

p { margin: 0.35em 0; }

.divider { border: none; border-top: 1px solid var(--line); margin: 34px 0; }
.muted { color: var(--ink-soft); }

code.inline {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.15em 0.42em;
  border-radius: 5px;
}

/* Sticky frosted-glass navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  transition: background 0.2s ease, color 0.2s ease;
}
.topbar a:hover { background: var(--hover); color: var(--ink); }
.topbar a.active { color: var(--ink); background: var(--bg-soft); font-weight: 600; }
