:root {
  --ink: #202421;
  --body: #3d433f;
  --muted: #626a65;
  --line: #e9ece9;
  --accent: #2f6758;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  font-feature-settings: "palt" 1;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

header {
  width: min(880px, calc(100% - 64px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0f1ef;
}

.brand,
.search-link { display: inline-flex; align-items: center; gap: 9px; }
.brand { font-size: 13px; font-weight: 750; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.search-link { color: #68716c; font-size: 11.5px; font-weight: 600; }
.search-link svg { color: var(--accent); }

main { width: min(760px, calc(100% - 64px)); margin: 0 auto; }
.breadcrumbs {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 10.5px;
}
.breadcrumbs a:hover { color: var(--accent); }
.article-head { padding: 66px 0 0; }

h1 {
  margin: 0;
  font-size: 38px;
  font-weight: 750;
  line-height: 1.42;
  letter-spacing: -0.045em;
}
h1 small { font-size: 0.46em; font-weight: 650; letter-spacing: -0.02em; }

.metadata {
  margin: 30px 0 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #555d58;
  font-size: 12px;
  line-height: 1.75;
}

.metadata > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
.metadata > div + div { margin-top: 5px; }
.metadata dt { color: var(--muted); font-weight: 600; }
.metadata dd { margin: 0; }

article { padding-bottom: 76px; }
section { padding-top: 70px; }

h2 {
  margin: 0 0 27px;
  padding: 1px 0 1px 13px;
  border-left: 2px solid var(--accent);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.35;
}

h3 { margin: 45px 0 14px; font-size: 15px; font-weight: 700; }
p { margin: 0 0 19px; color: var(--body); }
.problem { line-height: 2.05; }
.problem .question { font-weight: 400; }
.bullet { position: relative; padding-left: 1.15em; }
.bullet::before { position: absolute; left: 0; content: "・"; }
.source { margin-top: 21px; color: var(--muted); font-size: 10.5px; }
.plan { font-size: 15px; line-height: 1.95; }
.solution p { font-size: 15px; line-height: 1.9; }

.math {
  margin: 31px 0;
  min-height: 26px;
  display: grid;
  place-items: center;
  overflow-x: auto;
  text-align: center;
}

.answer {
  margin: 32px 0 43px;
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.problem-figure { margin: 34px 0; text-align: center; }
.problem-figure img { width: auto; max-width: min(100%, 620px); max-height: 520px; }
.figure-missing { color: #a64b43; font-size: 13px; text-align: center; }
.katex-error { color: #a64b43; font-family: monospace; }

.archive-head { padding-top: 52px; }
.archive-article { padding-bottom: 70px; }
.archive-article section + section { padding-top: 54px; }
.archive-article h2 a:hover { color: var(--accent); }
.archive-list { border-top: 1px solid var(--line); }
.archive-link {
  min-height: 53px;
  padding: 12px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.archive-link span { color: #303632; font-size: 14px; }
.archive-link small { color: var(--muted); font-size: 10.5px; text-align: right; }
.archive-link:hover span { color: var(--accent); }

.related-footer {
  padding: 42px 0 58px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px;
  border-top: 1px solid var(--line);
}

.related-footer h2 {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.related-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.related-links a {
  color: #343a36;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: #d4d9d6;
  text-underline-offset: 4px;
}
.related-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.related-links a.current { color: var(--accent); font-weight: 700; }

.katex { font-size: 1.04em; }
.math .katex { font-size: 1.14em; }

@media (max-width: 720px) {
  header,
  main { width: min(100% - 36px, 760px); }
  h1 { font-size: 30px; }
  .article-head { padding-top: 50px; }
  .breadcrumbs + .article-head { padding-top: 42px; }
  section { padding-top: 55px; }
  .metadata > div { grid-template-columns: 64px minmax(0, 1fr); }
  .related-footer { grid-template-columns: 1fr; gap: 30px; }
  .archive-link { align-items: flex-start; flex-direction: column; gap: 2px; }
  .archive-link small { text-align: left; }
}
