/* Design tokens — "Classical" system applied with the site's sans-serif face.
   See doc/design_handoff_blog_first_top/README.md for the source of these values. */
:root {
  --bg: #f3f2f2;
  --surface: #eae9e9;
  --fg: #201f1d;
  --muted: #605d5d;
  --muted-2: #7d7979;
  --line: color-mix(in srgb, #201f1d 16%, transparent);
  --accent: #0553b1;
  --accent-text: #04418a;
  --accent-100: #e8f0fb;
  --accent-800: #042f63;
  --neutral-100: #f8f4f4;
  --neutral-200: #eae7e7;
  --neutral-800: #444141;
  --neutral-900: #2d2b2b;
  --code-bg: var(--neutral-200);

  --space-1: 4.6px;
  --space-2: 9.2px;
  --space-3: 13.8px;
  --space-4: 18.4px;
  --space-6: 27.6px;
  --space-8: 36.8px;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 7px;
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);

  --max: 800px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: background-color .12s, color .12s;
}
a:hover { color: var(--accent); text-decoration: underline; }

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

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; margin: 0; }
p { margin: 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.tnum { font-feature-settings: "tnum"; }
.icon { display: block; flex: none; }

/* ── Reusable parts ───────────────────────────────────────────── */
.plate {
  border: 6px solid var(--surface);
  outline: 1px solid var(--line);
  filter: sepia(.22) saturate(.82) contrast(1.05);
  box-sizing: border-box;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fg);
  background: transparent;
  border: 1px solid transparent;
  padding: 9.2px 16.6px;
  border-radius: var(--radius-md);
  transition: background-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn svg { display: block; }
.btn-primary { color: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn-primary:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-ghost { color: var(--accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.btn-ghost:active { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: .02em;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  transition: background-color .12s, color .12s;
}
.tag:hover { text-decoration: none; }
.tag-accent { background: var(--accent-100); color: var(--accent-800); }
.tag-neutral { background: var(--neutral-100); color: var(--neutral-800); }
.tag-outline { border-color: var(--accent); color: var(--accent); background: transparent; }
button.tag { cursor: pointer; gap: 6px; }
button.tag-neutral:hover { background: color-mix(in srgb, var(--accent) 10%, var(--neutral-100)); }
.tag .count { color: var(--muted-2); font-size: 10px; font-feature-settings: "tnum"; }

.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

.input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px 6px 30px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  caret-color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
}
.input::-webkit-search-cancel-button { -webkit-appearance: none; }
.input:hover { border-color: color-mix(in srgb, var(--fg) 45%, transparent); }
.input:focus-visible { border-color: var(--accent); outline-offset: 0; }

/* ── Layout ───────────────────────────────────────────────────── */
.page {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-8);
  border-bottom: 1px solid var(--line);
}
.site-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-right: auto;
  color: inherit;
}
.site-name:hover { text-decoration: none; color: inherit; }
.site-name .avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  outline: 1px solid var(--line);
  flex: none;
}
.site-name .name { font-size: 20px; line-height: 1.2; font-weight: 600; }
.site-name .role { font-size: 12px; color: var(--muted); white-space: nowrap; }

.site-nav { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.site-nav a { color: inherit; font-size: 14px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); text-decoration: none; }
.site-nav .lang-switch { display: inline-flex; align-items: center; gap: 6px; }

.site-main { flex: 1; padding: var(--space-6) var(--space-8) var(--space-8); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-4) var(--space-8) var(--space-6);
  font-size: 12px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

/* ── Post rows (home + list) ──────────────────────────────────── */
.post-list {
  list-style: none;
  margin: var(--space-8) 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.blog-index .post-list { margin-top: var(--space-4); border-top: 0; }

.post-card { border-bottom: 1px solid var(--line); }
.post-card > a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  color: inherit;
  text-decoration: none;
}
.post-card > a:hover { color: inherit; text-decoration: none; }
.post-card > a:hover .post-title { color: var(--accent); }
.post-card .post-text { display: grid; gap: 4px; align-content: start; }
.post-card .post-meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-feature-settings: "tnum";
}
.post-card .post-meta .tag { font-size: 10px; padding: 1px 7px; }
.post-card .post-title { font-size: 20px; line-height: 1.4; transition: color .12s; }
.blog-index .post-card .post-title { font-size: 21px; line-height: 1.35; }
.post-card .post-desc {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
  text-align: justify;
}
.post-card .thumb {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-width: 4px;
}

/* ── Home ─────────────────────────────────────────────────────── */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding: var(--space-4) var(--space-6);
  background: var(--accent-100);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
}
.notice h2 { font-size: 17px; font-weight: 600; color: var(--accent-800); margin: 0 0 var(--space-1); }
.notice p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--accent-text); }
.notice .btn { flex-shrink: 0; background: var(--bg); }
@media (max-width: 600px) {
  .notice { flex-direction: column; align-items: flex-start; }
}

.featured {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.featured.no-image { grid-template-columns: minmax(0, 1fr); max-width: 40rem; }
.featured .featured-image { display: block; }
.featured .featured-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.featured .featured-text { display: grid; gap: var(--space-3); }
.featured .kicker {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-feature-settings: "tnum";
}
.featured h1 { font-size: 32px; line-height: 1.3; font-weight: 400; }
.featured.no-image h1 { font-size: 40px; line-height: 1.2; }
.featured h1 a { color: inherit; text-decoration: none; }
.featured h1 a:hover { color: var(--accent); }
.featured .featured-desc { font-size: 15px; text-align: justify; color: var(--neutral-800); }
.featured .tags { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.featured .read-more { justify-self: start; margin-left: calc(-1 * var(--space-1)); }

.more { display: flex; justify-content: center; margin-top: var(--space-6); }

.about-rule { margin: 96px 0 var(--space-6); }
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}
.about .about-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.about .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border-width: 3px;
}
.about h2 { font-size: 24px; }
.about .about-sub { font-size: 13px; color: var(--muted); }
.about .bio p { margin: 0 0 var(--space-3); font-size: 15px; text-align: justify; }
.about .bio p:last-child { margin-bottom: var(--space-4); }
.about .links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  font-size: 14px;
}
.about .links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.about .links a:hover { text-decoration: underline; }

.talk h2 { font-size: 24px; margin-bottom: var(--space-3); }
.video {
  aspect-ratio: 16 / 9;
  background: var(--neutral-900);
  overflow: hidden;
}
.video iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-caption {
  font-size: 11px;
  margin-top: var(--space-1);
  color: color-mix(in srgb, var(--fg) 55%, transparent);
}

/* ── Blog list ────────────────────────────────────────────────── */
.blog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.blog-head h1 { font-size: 36px; font-weight: 400; margin-bottom: var(--space-1); }
.blog-head .lead { font-size: 14px; color: var(--muted); }
.search { position: relative; width: 260px; max-width: 100%; }
.search .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}
.blog-index .hr { margin: var(--space-4) 0 var(--space-3); }
.tag-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.tag-bar .result-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-feature-settings: "tnum";
}
.empty {
  margin: var(--space-8) 0;
  text-align: center;
  color: var(--muted);
}

/* ── Post page ────────────────────────────────────────────────── */
.post { max-width: 44rem; margin: 0 auto; line-height: 1.95; }
.post-header { margin-bottom: var(--space-6); }
.post-header .post-date {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  font-feature-settings: "tnum";
  margin-bottom: var(--space-2);
}
.post-header h1 { font-size: 36px; line-height: 1.3; font-weight: 400; margin-bottom: var(--space-3); }
.post-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.post-header .hr { margin-top: var(--space-4); }

.post-body { text-align: justify; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 var(--space-4); }
.post-body li { margin: 0.25rem 0; }
.post-body h2 {
  font-size: 28px;
  font-weight: 400;
  margin: var(--space-8) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}
.post-body h3 { font-size: 22px; font-weight: 400; margin: var(--space-6) 0 var(--space-2); }
.post-body h4 { font-size: 18px; margin: var(--space-4) 0 var(--space-2); }
.post-body strong { font-weight: 600; }
.post-body img {
  width: 100%;
  margin: var(--space-6) 0;
  border: 6px solid var(--surface);
  outline: 1px solid var(--line);
  filter: sepia(.22) saturate(.82) contrast(1.05);
}
.post-body figure { margin: 0; }
.post-body figcaption {
  display: block;
  text-align: center;
  font-size: 11px;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  margin-top: calc(-1 * var(--space-4));
}
.post-body blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-1) var(--space-4);
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-8) 0; }
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}
.post-body pre {
  background: var(--code-bg);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: 1.5;
  margin: 0 0 var(--space-4);
}
.post-body pre code { background: none; padding: 0; font-size: 0.85rem; }
.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-6) 0;
  font-size: 0.95rem;
}
.post-body th, .post-body td {
  border: 1px solid var(--line);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}
.post-body th { background: var(--surface); font-weight: 600; }
.post-body .footnotes {
  margin-top: var(--space-8);
  font-size: 13px;
  color: var(--muted);
}
.post-body .footnotes ol { padding-left: 1.25rem; }

.post-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.post-footer .btn-ghost { margin-left: calc(-1 * var(--space-1)); }
.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 13px;
}
.author-chip:hover { color: inherit; text-decoration: none; }
.author-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  outline: 1px solid var(--line);
}
.author-chip .role { color: var(--muted); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header, .site-main, .site-footer { padding-left: var(--space-4); padding-right: var(--space-4); }
  .featured { grid-template-columns: minmax(0, 1fr); }
  .about { grid-template-columns: minmax(0, 1fr); }
  .post-card .thumb { width: 96px; height: 72px; }
  .featured h1, .featured.no-image h1 { font-size: 28px; }
  .blog-head h1, .post-header h1 { font-size: 30px; }
  .search { width: 100%; }
}
@media (max-width: 540px) {
  .site-name .role { display: none; }
  .site-name .name { font-size: 17px; }
}

/* ── Embeds in post bodies ────────────────────────────────────── */
.embed { margin: var(--space-6) 0; text-align: left; }

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: background-color .12s, border-color .12s;
}
.link-card:hover {
  color: inherit;
  text-decoration: none;
  border-color: color-mix(in srgb, var(--fg) 45%, transparent);
  background: color-mix(in srgb, var(--fg) 3%, transparent);
}
.link-card-text { display: grid; gap: 2px; min-width: 0; }
.link-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-card-plain .link-card-title { font-weight: 400; color: var(--accent-text); }
.link-card-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-card-site { font-size: 12px; color: var(--muted-2); font-feature-settings: "tnum"; }
.link-card-image {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-width: 4px;
  margin: 0;
}

.embed-youtube {
  aspect-ratio: 16 / 9;
  background: var(--neutral-900);
  overflow: hidden;
}
.embed-youtube iframe { display: block; width: 100%; height: 100%; border: 0; }

.post-body .embed blockquote.twitter-tweet {
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--fg);
  max-width: 550px;
}
.post-body .embed .twitter-tweet-rendered { margin: 0 auto; }

.gist-embed { font-size: 13px; }
.gist-embed .gist .gist-file { border-color: var(--line); border-radius: var(--radius-md); margin-bottom: 0; }
.gist-embed .gist .gist-meta { font-family: var(--font-sans); }

@media (max-width: 600px) {
  .link-card-image { width: 96px; height: 72px; }
}
