:root {
  --background: #fafafa;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --soft: #f4f4f5;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --font: "IBM Plex Sans", "Noto Sans SC", sans-serif;
  --container: min(100% - 40px, 1000px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: #dbeafe; }

.container { width: var(--container); margin-inline: auto; }
section[id] { scroll-margin-top: 84px; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: #fff;
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 250, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -.025em;
}
.site-header nav { display: flex; align-items: center; gap: 24px; }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
}
.site-header nav a:hover { color: var(--text); }

.hero { padding: 112px 0 108px; border-bottom: 1px solid var(--border); }
.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  line-height: 1.15;
  letter-spacing: -.04em;
  font-weight: 600;
}
.intro { max-width: 680px; margin: 22px 0 0; color: #3f3f46; font-size: 1.1rem; line-height: 1.8; }
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.button.primary { background: var(--text); color: #fff; border: 1px solid var(--text); }
.button.primary:hover { background: #3f3f46; }
.button.secondary { background: var(--surface); border: 1px solid var(--border); }
.button.secondary:hover { border-color: #a1a1aa; }

.section { padding: 88px 0; }
.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.section-header h2 { margin: 0; font-size: 1.75rem; line-height: 1.25; letter-spacing: -.03em; font-weight: 600; }
.section-header p { margin: 7px 0 0; color: var(--muted); font-size: .92rem; }
.section-header .section-kicker { margin: 0 0 7px; color: var(--accent); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.section-header > a { color: var(--muted); font-size: .88rem; text-decoration: none; white-space: nowrap; }
.section-header > a:hover { color: var(--accent); }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.project-card:hover {
  border-color: #d4d4d8;
  box-shadow: 0 8px 24px rgba(24, 24, 27, .06);
  transform: translateY(-2px);
}
.project-card--lead { border-top: 2px solid var(--text); }
.project-top { display: flex; align-items: center; justify-content: space-between; }
.project-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d4d4d8;
  border-radius: 999px;
  color: #52525b;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.repo-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--soft);
  border-radius: 7px;
  color: #52525b;
  font-size: .9rem;
}
.arrow-link { color: #a1a1aa; text-decoration: none; font-size: 1.15rem; }
.project-card:hover .arrow-link { color: var(--accent); }
.project-card h3 { margin: 22px 0 10px; font-size: 1.1rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.project-card h3 a { text-decoration: none; }
.project-card h3 a:hover { color: var(--accent); }
.project-card > p { margin: 0 0 24px; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.project-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #a1a1aa;
  font-size: .76rem;
}
.project-meta span { display: inline-flex; align-items: center; }
.dot { width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; }
.dot-html { background: #e34c26; }
.dot-python { background: #3572a5; }
.dot-js { background: #d4bd21; }
.dot-ts { background: #3178c6; }
.dot-css { background: #563d7c; }

.blog-section { padding-top: 30px; }
.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.featured-post {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 34px 32px 34px 0;
}
.post-index { color: #a1a1aa; font-size: .76rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.post-copy { display: flex; flex-direction: column; align-items: flex-start; }
.post-meta { display: flex; flex-wrap: wrap; gap: 9px 16px; color: #a1a1aa; font-size: .74rem; }
.post-meta span { position: relative; }
.post-meta span::before { content: "·"; position: absolute; left: -10px; }
.featured-post h3 { max-width: 650px; margin: 24px 0 12px; font-size: 1.35rem; line-height: 1.4; letter-spacing: -.02em; font-weight: 600; }
.featured-post h3 a { text-decoration: none; }
.featured-post h3 a:hover { color: var(--accent); }
.featured-post p { max-width: 660px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.75; }
.post-read { margin-top: 22px; color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 500; }
.post-read:hover { color: var(--accent); }
.writing-map { padding: 32px 0 32px 32px; border-left: 1px solid var(--border); }
.writing-map__label { margin: 0 0 15px; color: var(--muted); font-size: .78rem; font-weight: 500; }
.writing-map ol { margin: 0; padding: 0; list-style: none; }
.writing-map li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid var(--border); }
.writing-map li > span { color: #94a3b8; font-size: .72rem; font-variant-numeric: tabular-nums; }
.writing-map li p { margin: 0; }
.writing-map strong, .writing-map small { display: block; }
.writing-map strong { font-size: .87rem; font-weight: 600; }
.writing-map small { margin-top: 3px; color: #64748b; font-size: .76rem; line-height: 1.5; }

.blog-main { padding: 74px 0 96px; }
.blog-hero { max-width: 760px; padding-bottom: 44px; border-bottom: 1px solid var(--border); }
.blog-hero h1 { margin: 0; font-size: clamp(2.25rem, 5vw, 3.2rem); line-height: 1.12; letter-spacing: -.04em; font-weight: 600; }
.blog-hero .lead { max-width: 680px; margin: 18px 0 0; color: #3f3f46; font-size: 1rem; line-height: 1.8; }
.blog-principle { margin: 18px 0 0; color: var(--muted); font-size: .86rem; }
.post-list { margin-top: 58px; }
.post-list__heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 22px; }
.post-list__heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.025em; }
.post-list__heading span { color: var(--muted); font-size: .8rem; }
.post-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 28px; align-items: start; padding: 28px 2px; border-top: 1px solid var(--border); text-decoration: none; }
.post-row:last-child { border-bottom: 1px solid var(--border); }
.post-row:hover h3 { color: var(--accent); }
.post-row time { color: #a1a1aa; font-size: .76rem; font-variant-numeric: tabular-nums; }
.post-row h3 { margin: -3px 0 7px; font-size: 1.15rem; line-height: 1.45; font-weight: 600; transition: color .15s; }
.post-row p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.post-row > span { color: #a1a1aa; font-size: .85rem; }
.post-row .post-row__series { display: block; margin: -3px 0 9px; color: #52525b; font-size: .7rem; font-weight: 600; letter-spacing: .06em; }
.series-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 64px; }
.series-card { min-height: 145px; padding: 18px 0; border-top: 1px solid var(--border); }
.series-card--active { border-top: 2px solid var(--text); }
.series-card span { color: #94a3b8; font-size: .72rem; }
.series-card h3 { margin: 32px 0 7px; font-size: .94rem; }
.series-card p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.article-main { padding: 76px 0 110px; }
.article-header { max-width: 780px; margin: 0 auto; padding-bottom: 48px; border-bottom: 1px solid var(--border); }
.article-category { margin: 0 0 14px; color: var(--muted); font-size: .76rem; font-weight: 500; }
.series-marker { margin-right: 10px; color: var(--text); letter-spacing: .06em; }
.article-header h1 { margin: 0 0 24px; font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.18; letter-spacing: -.04em; font-weight: 600; }
.article-dek { margin: 0; color: #52525b; font-size: 1.05rem; line-height: 1.8; }
.article-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 24px; color: #a1a1aa; font-size: .78rem; }
.article-body { max-width: 720px; margin: 54px auto 0; }
.article-body h2 { margin: 54px 0 18px; font-size: 1.55rem; line-height: 1.35; letter-spacing: -.025em; }
.article-body h3 { margin: 34px 0 12px; font-size: 1.05rem; }
.article-body p, .article-body li { color: #3f3f46; line-height: 1.95; }
.article-body ul, .article-body ol { padding-left: 1.35rem; }
.article-body li + li { margin-top: 8px; }
.article-body a { color: var(--accent); text-underline-offset: 3px; }
.route-line { margin: 24px 0; padding: 15px 18px; border-left: 3px solid var(--text); background: var(--soft); font-size: .9rem; font-weight: 500; }
.article-figure {
  width: min(920px, calc(100vw - 40px));
  margin: 42px 0 48px 50%;
  transform: translateX(-50%);
}
.article-figure a { display: block; color: inherit; text-decoration: none; }
.article-figure img { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--soft); }
.article-figure video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: 10px; background: #111; }
.article-figure figcaption { margin-top: 11px; color: var(--muted); font-size: .76rem; line-height: 1.65; }
.article-body blockquote { margin: 36px 0; padding: 20px 24px; border-left: 3px solid var(--accent); background: #eff6ff; color: #1e3a5f; }
.article-body blockquote p { margin: 0; color: inherit; }
.article-body code { padding: 2px 5px; border-radius: 4px; background: var(--soft); font-family: Consolas, monospace; font-size: .88em; }
.article-body pre { margin: 22px 0 28px; overflow-x: auto; border: 1px solid #27272a; border-radius: 8px; background: #18181b; }
.article-body pre code { display: block; min-width: max-content; padding: 18px 20px; background: transparent; color: #e4e4e7; font-size: .78rem; line-height: 1.75; }
.article-body table { width: 100%; margin: 28px 0; border-collapse: collapse; font-size: .86rem; }
.article-body th, .article-body td { padding: 13px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.article-body th { background: var(--soft); font-weight: 600; }
.article-body td { color: #52525b; }
.article-callout { margin: 36px 0; padding: 24px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.article-callout strong { display: block; margin-bottom: 7px; color: #1e3a5f; }
.article-callout p { margin: 0; }
.article-callout--neutral { border-color: var(--border); background: var(--soft); }
.article-callout--neutral strong { color: var(--text); }
.article-end { display: flex; justify-content: space-between; gap: 20px; max-width: 720px; margin: 64px auto 0; padding-top: 26px; border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; }
.article-end a { text-decoration: none; }
.article-end a:hover { color: var(--accent); }

.updates-section { padding-top: 24px; }
.updates-list { border-top: 1px solid var(--border); }
.updates-list a {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 17px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: .86rem;
}
.updates-list a:hover { background: rgba(244, 244, 245, .7); }
.update-repo { font-weight: 500; overflow-wrap: anywhere; }
.update-message { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.updates-list time { color: #a1a1aa; font-size: .76rem; font-variant-numeric: tabular-nums; }

.site-footer { margin-top: 24px; border-top: 1px solid var(--border); }
.footer-inner {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: .82rem;
}
.footer-inner p { margin: 0; }
.footer-inner div { display: flex; gap: 18px; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

.not-found { min-height: calc(100vh - 159px); display: grid; place-items: center; text-align: center; }
.not-found h1 { margin: 0; font-size: 4rem; line-height: 1; letter-spacing: -.05em; }
.not-found p { color: var(--muted); }

@media (max-width: 720px) {
  :root { --container: min(100% - 32px, 1000px); }
  .header-inner { min-height: 58px; }
  .site-header nav { gap: 14px; }
  .site-header nav a { font-size: .8rem; }
  .site-header nav .nav-updates { display: none; }
  .hero { padding: 76px 0 72px; }
  .hero h1 { font-size: clamp(2.5rem, 12vw, 3.6rem); }
  .intro { font-size: 1rem; }
  .section { padding: 68px 0; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 225px; }
  .blog-layout { grid-template-columns: 1fr; }
  .featured-post { grid-template-columns: 1fr; padding: 28px 0; }
  .post-index { margin-bottom: 18px; }
  .featured-post h3 { margin-top: 20px; }
  .writing-map { padding: 28px 0; border-top: 1px solid var(--border); border-left: 0; }
  .blog-main, .article-main { padding-top: 56px; }
  .post-row { grid-template-columns: 1fr auto; gap: 8px 18px; }
  .post-row time { grid-column: 1; }
  .post-row div { grid-column: 1 / -1; }
  .post-row > span { grid-column: 2; grid-row: 1; }
  .series-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-end { flex-direction: column; }
  .article-body table { display: block; overflow-x: auto; white-space: nowrap; }
  .updates-section { padding-top: 8px; }
  .updates-list a { grid-template-columns: 1fr auto; gap: 5px 16px; }
  .update-message { grid-column: 1 / -1; grid-row: 2; white-space: normal; font-size: .8rem; }
  .updates-list time { grid-column: 2; grid-row: 1; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 9px; }
}

@media (max-width: 460px) {
  .site-header nav a:last-child { display: none; }
  .series-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
