:root {
  color-scheme: light;
  --paper: #f7f6f3;
  --ink: #17191d;
  --muted: #5d626b;
  --faint: #686f79;
  --line: #d5d7da;
  --line-strong: #858b94;
  --soft: #ffffff;
  --accent: #304fd6;
  --accent-soft: #e5eaff;
  --code: #ffffff;
  --shadow-tooltip: 0 8px 24px rgb(0 0 0 / 14%);
  --sans: "Instrument Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #111923;
  --ink: #eef2f6;
  --muted: #a7b0bc;
  --faint: #8995a5;
  --line: #3a4654;
  --line-strong: #5c6979;
  --soft: #192431;
  --accent: #8aa8ff;
  --accent-soft: #26385f;
  --code: #16212d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

#main-content { flex: 1 0 auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input { font: inherit; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  transition: top 160ms var(--ease-out);
}
.skip-link:focus { top: 16px; }

.site-shell { width: min(100% - 48px, 1040px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.site-wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 15px; font-weight: 400; letter-spacing: -.01em; text-decoration: none; }
.site-wordmark-mark { flex: 0 0 auto; color: var(--accent); }
.site-wordmark-mark rect { fill: currentColor; }
.site-wordmark:hover span, .site-wordmark:focus-visible span { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 28px; font-family: var(--mono); font-size: 12px; }
.site-nav a { color: var(--muted); text-decoration: none; transition: color 140ms ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--ink); }
.theme-toggle {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, transform 140ms var(--ease-out);
}
.theme-toggle:hover { color: var(--ink); background: var(--soft); }
.theme-toggle:active { transform: scale(.96); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

.home-hero { padding: 68px 0 60px; }
.home-intro { max-width: 720px; color: var(--ink); font-size: 17px; font-weight: 400; letter-spacing: 0; line-height: 1.72; }
.home-intro p { margin: 0; }
.home-intro p + p { margin-top: 18px; color: var(--muted); font-size: .86em; line-height: 1.5; }
.home-status { display: flex; width: fit-content; gap: 12px; align-items: baseline; margin: 28px 0 0; color: var(--accent); font-family: var(--mono); font-size: 12px; text-decoration: none; }
.home-status span { color: var(--muted); }
.home-status-arrow { transition: color 140ms ease, transform 140ms var(--ease-out); }
.home-status:hover .home-status-arrow, .home-status:focus-visible .home-status-arrow { color: var(--accent); transform: translateX(3px); }

.home-section { padding: 54px 0; border-top: 1px solid var(--line); }
.section-heading-row { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-heading-row h2, .about-strip h2 { margin: 0; font-family: var(--sans); font-size: 15px; font-weight: 400; letter-spacing: -.01em; }
.section-heading-row p, .section-heading-row a { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.activity-section .section-heading-row p { font-size: 11px; letter-spacing: .045em; text-transform: uppercase; }
.section-heading-row a { transition: color 140ms ease; }
.section-heading-row a:hover { color: var(--accent); }

.activity-graph { position: relative; }
.activity-scroll { overflow-x: auto; width: 100%; padding: 8px 0 12px; scrollbar-width: thin; }
.activity-scroll:focus-visible { outline: 1px solid var(--accent); outline-offset: 5px; }
.activity-months, .activity-grid { display: grid; grid-template-columns: repeat(53, minmax(12px, 1fr)); column-gap: 5px; width: 100%; min-width: 896px; }
.activity-months { min-height: 22px; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.activity-grid { grid-template-rows: repeat(7, 12px); row-gap: 5px; }
.activity-cell { display: block; width: 100%; min-width: 12px; height: 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--soft); outline: 0; transition: transform 120ms var(--ease-out), border-color 120ms ease; }
.activity-cell[data-level="1"] {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--accent) 0 1px, transparent 1.1px);
  background-position: 0 0;
  background-size: 5px 5px;
}
.activity-cell[data-level="2"] {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--accent) 0 1px, transparent 1.1px);
  background-position: 0 0;
  background-size: 3px 3px;
}
.activity-cell[data-level="3"] {
  border-color: color-mix(in srgb, var(--accent) 78%, var(--line));
  background-color: var(--paper);
  background-image:
    radial-gradient(circle, var(--accent) 0 1.15px, transparent 1.25px),
    radial-gradient(circle, var(--accent) 0 1.15px, transparent 1.25px);
  background-position: 0 0, 2px 2px;
  background-size: 4px 4px;
}
.activity-cell[data-level="4"] { border-color: var(--accent); background: var(--accent); }
.activity-cell[href]:hover, .activity-cell[href]:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--accent); }
.activity-tooltip { position: absolute; z-index: 5; width: max-content; max-width: 260px; transform: translate(-50%, -100%); padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-tooltip); font-family: var(--mono); font-size: 11px; line-height: 1.45; pointer-events: none; }
.activity-tooltip strong, .activity-tooltip span { display: block; }
.activity-tooltip span { margin-top: 2px; opacity: .72; }
.activity-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .045em; text-transform: uppercase; }
.activity-summary span { padding-left: 32px; border-left: 1px solid var(--line); }
.activity-summary span:first-child { padding-left: 0; border-left: 0; }
.activity-summary strong, .activity-summary number-flow { margin-right: 4px; color: var(--ink); font-family: var(--sans); font-size: 24px; font-weight: 400; letter-spacing: -.02em; line-height: .9; font-variant-numeric: tabular-nums; }

.work-list { border-bottom: 1px solid var(--line); }
.work-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 20px; gap: 22px; align-items: center; min-height: 62px; border-top: 1px solid var(--line); text-decoration: none; transition: background-color 150ms ease; }
.work-row:hover { background: var(--soft); }
.work-row time { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.work-title { overflow: hidden; font-size: 17px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.work-row svg { fill: none; stroke: var(--muted); stroke-width: 1.4; transition: transform 150ms var(--ease-out), stroke 150ms ease; }
.work-row:hover svg { transform: translateX(3px); stroke: var(--accent); }

.question-list { margin: 0; padding: 0; list-style: none; }
.question-list li { display: grid; grid-template-columns: 54px 1fr; padding: 18px 0; border-top: 1px solid var(--line); }
.question-list li:last-child { border-bottom: 1px solid var(--line); }
.question-list span { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.question-list p { max-width: 720px; margin: 0; font-size: clamp(17px, 2vw, 21px); letter-spacing: -.018em; line-height: 1.4; }
.about-strip { display: grid; grid-template-columns: 180px minmax(0, 640px); gap: 56px; }
.about-strip > div { color: var(--muted); }
.about-strip p:first-child { margin-top: 0; }

.page, .post { width: min(100%, 720px); margin: 0 auto; padding: 72px 0 100px; }
.page-header, .post-header { margin-bottom: 50px; }
.page-title, .post-title { margin: 0; font-family: var(--sans); font-size: clamp(32px, 4vw, 48px); font-weight: 400; letter-spacing: -.025em; line-height: 1.08; }
.post-kicker { margin: 0 0 16px; color: var(--accent); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 20px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.post-actions { display: flex; gap: 8px; margin-top: 24px; }
.post-action { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 12px; transition: color 140ms ease, background-color 140ms ease, transform 140ms var(--ease-out); }
.post-action:hover { color: var(--ink); background: var(--soft); }
.post-action:active { transform: scale(.97); }
.post-action svg { fill: none; stroke: currentColor; stroke-width: 1.7; }

.post-content { font-size: 17px; line-height: 1.72; }
.post-content h2, .post-content h3, .post-content h4 { margin: 2.2em 0 .65em; color: var(--ink); font-family: var(--sans); font-weight: 400; letter-spacing: -.02em; line-height: 1.15; }
.post-content h2 { font-size: 29px; }
.post-content h3 { font-size: 22px; }
.post-content p, .post-content ul, .post-content ol { margin: 0 0 1.35em; }
.post-content a { color: var(--accent); }
.post-content p a,
.post-content li a,
.post-content blockquote a {
  padding-inline: .08em;
  margin-inline: -.08em;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  text-decoration: none;
  transition: background-size 180ms var(--ease-out), color 140ms ease;
}
.post-content p a:hover,
.post-content p a:focus-visible,
.post-content li a:hover,
.post-content li a:focus-visible,
.post-content blockquote a:hover,
.post-content blockquote a:focus-visible {
  background-size: 100% 100%;
  color: var(--paper);
}
.text-highlighter {
  padding-inline: .08em;
  margin-inline: -.08em;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 100%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-size 620ms var(--ease-out);
}
.text-highlighter.is-visible { background-size: 100% 100%; }
.media-between-text { display: flex; flex-wrap: wrap; align-items: center; gap: .35em; margin: 34px 0; font-size: clamp(24px, 5vw, 44px); line-height: 1.08; }
.media-between-text__media { display: inline-block; overflow: hidden; width: 0; opacity: 0; transition: width 420ms var(--ease-out), opacity 220ms ease; }
.media-between-text.is-visible .media-between-text__media { width: clamp(120px, 24vw, 220px); opacity: 1; }
.media-between-text__media img, .media-between-text__media video { display: block; width: clamp(120px, 24vw, 220px); height: 1.15em; margin: 0; border-radius: 5px; object-fit: cover; }
.media-between-text figcaption { flex-basis: 100%; margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 11px; line-height: 1.5; }
.post-content img, .post-content video, .post-content iframe { display: block; max-width: 100%; margin: 34px auto; border-radius: 10px; }
.post-content blockquote { margin: 32px 0; padding: 2px 0 2px 20px; border-left: 2px solid var(--accent); color: var(--ink); }
.post-content pre { overflow-x: auto; margin: 28px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--code) !important; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
.post-content pre code { padding: 0; border: 0; background: transparent !important; color: inherit; tab-size: 2; }
:root[data-theme="dark"] .hljs { color: #d6deeb; background: transparent !important; }
:root[data-theme="dark"] .hljs-comment,
:root[data-theme="dark"] .hljs-quote { color: #8b9aaa; }
:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-tag { color: #c792ea; }
:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-attr { color: #addb67; }
:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-literal { color: #f78c6c; }
:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-function { color: #82aaff; }
.post-content :not(pre) > code { padding: .13em .35em; border: 1px solid var(--line); border-radius: 4px; background: var(--code); font-family: var(--mono); font-size: .82em; }
.post-content table { display: block; overflow-x: auto; width: 100%; margin: 28px 0; border-collapse: collapse; font-size: 14px; }
.post-content th, .post-content td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.post-content hr { margin: 54px 0; border: 0; border-top: 1px solid var(--line); }

.post_navi { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); }
.post_navi-item { display: block; text-decoration: none; }
.post_navi-label { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.nav_next { text-align: right; }
.post_navi-arrow { display: none; }

.archive-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.archive-filter { min-height: 38px; padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 12px; }
.archive-filter:hover, .archive-filter.active { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.archive-year { margin: 46px 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.archive-list { margin: 0; padding: 0; list-style: none; }
.archive-list li { display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; align-items: baseline; padding: 13px 0; border-top: 1px solid var(--line); }
.archive-date, .archive-tag { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.archive-tag + .archive-tag { display: none; }
.series-card { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.series-card h3 { margin: 0; font-size: 24px; }
.series-meta, .series-toc-date { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.series-toc { padding-left: 22px; }
.series-toc li { padding: 9px 0; }
.series-toc-date { float: right; }

.site-footer { flex-shrink: 0; border-top: 1px solid var(--line); }
.footer-inner { padding-top: 26px; padding-bottom: 34px; }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-social { display: flex; align-items: center; gap: 16px; }
.footer-social a { color: var(--muted); transition: color 140ms ease; }
.footer-social a:hover { color: var(--ink); }
.footer-tagline { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 11px; }

@media (max-width: 720px) {
  .site-shell { width: min(100% - 32px, 1040px); }
  .site-header-inner { min-height: 58px; }
  .site-nav { gap: 15px; }
  .site-nav a:nth-child(2), .site-nav a:nth-child(3) { display: none; }
  .home-hero { padding: 54px 0 48px; }
  .home-intro { font-size: 16px; }
  .home-section { padding: 42px 0; }
  .section-heading-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .activity-summary { grid-template-columns: 1fr; gap: 12px; }
  .activity-summary span, .activity-summary span:first-child { padding: 0; border: 0; }
  .activity-months, .activity-grid { grid-template-columns: repeat(53, 11px); column-gap: 4px; min-width: 791px; }
  .activity-cell { min-width: 11px; height: 11px; }
  .work-row { grid-template-columns: 82px minmax(0, 1fr) 18px; gap: 12px; min-height: 68px; }
  .work-title { white-space: normal; line-height: 1.3; }
  .question-list li { grid-template-columns: 42px 1fr; }
  .about-strip { grid-template-columns: 1fr; gap: 18px; }
  .page, .post { padding: 52px 0 76px; }
  .post-content { font-size: 16px; }
  .archive-list li { grid-template-columns: 62px 1fr; }
  .archive-tag { display: none; }
  .post_navi { grid-template-columns: 1fr; }
  .nav_next { text-align: left; }
  .footer-row { align-items: center; }
}

@media (hover: hover) and (pointer: fine) {
  .work-row:hover { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .text-highlighter { background-size: 100% 100%; }
  .media-between-text__media { width: clamp(120px, 24vw, 220px); opacity: 1; }
}
