:root {
  color-scheme: light;
  --primary: #7c6f5a;
  --secondary: #4a7c59;
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #1f2328;
  --muted: #59636e;
  --border: #e1e4e8;
  --font: "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --radius: 14px;
}

/* Skein の静的書き出しの同梱スタイル。先頭の :root (テーマの値) は書き出し時に足す。 */

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

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

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

a {
  color: var(--primary);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--secondary);
}

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 8px;
  top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 10;
}

/* ヘッダ・フッタ */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 24px 0 16px;
}

.site-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav ul,
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.site-nav a,
.footer-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover,
.footer-nav a:hover {
  color: var(--primary);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 8px 0 0;
}

.footer-feed a {
  color: var(--muted);
}

/* 段組み */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px;
  padding-top: 32px;
}

.layout-single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 800px;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}

/* 記事 */

.entry-header h1,
.list-header h1,
.notfound h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.4;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.terms,
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.term,
.tag-cloud a {
  display: inline-block;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.9;
  text-decoration: none;
}

.term-category {
  border-color: var(--primary);
  color: var(--primary);
}

.term:hover,
.tag-cloud a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.toc {
  margin: 32px 0 0;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.toc-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-2 {
  padding-left: 1.25em;
}

.toc-3 {
  padding-left: 2.5em;
}

/* 本文 (markdownToHtml の出力)。見た目は焼き込まれていないので、ここで整える。 */

.body {
  margin-top: 32px;
}

.body > :first-child {
  margin-top: 0;
}

.body h1,
.body h2,
.body h3,
.body h4,
.body h5,
.body h6 {
  margin: 2em 0 0.6em;
  line-height: 1.5;
  scroll-margin-top: 16px;
}

.body h2 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
  font-size: 1.5rem;
}

.body h3 {
  font-size: 1.25rem;
}

.body p,
.body ul,
.body ol,
.body blockquote,
.body pre,
.body table,
.body figure {
  margin: 0 0 1.25em;
}

.body li + li {
  margin-top: 0.25em;
}

.body blockquote {
  padding: 4px 16px;
  border-left: 4px solid var(--border);
  color: var(--muted);
}

.body code {
  padding: 0.15em 0.4em;
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.body pre,
.raw {
  padding: 16px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.6;
}

.raw {
  margin-top: 32px;
  white-space: pre-wrap;
}

.body pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.body th,
.body td {
  padding: 6px 12px;
  border: 1px solid var(--border);
}

.body th {
  background: var(--surface);
}

.body hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.body img {
  border-radius: var(--radius);
}

/* 記事の末尾 */

.author {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.avatar {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.author p {
  margin: 0;
}

.author-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.author-name {
  font-weight: 700;
}

.author-bio {
  white-space: pre-line;
  font-size: 0.9rem;
}

.adjacent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}

.adjacent a {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.adjacent a:hover {
  border-color: var(--primary);
}

.adjacent span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.adjacent .newer {
  grid-column: 2;
  text-align: right;
}

.related {
  margin-top: 40px;
}

.related h2,
.sidebar h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.related ul,
.sidebar ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related li,
.sidebar li {
  padding: 4px 0;
}

.related time,
.count {
  color: var(--muted);
  font-size: 0.8rem;
}

/* 一覧 */

.list-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.cards {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.card {
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.5;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover {
  color: var(--primary);
}

.excerpt {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.empty {
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
}

.pager-older {
  margin-left: auto;
}

/* サイドバー */

.sidebar {
  display: grid;
  align-content: start;
  gap: 32px;
  font-size: 0.9rem;
}

.notfound p {
  margin: 16px 0 0;
}

/* パンくず */

.breadcrumbs {
  margin: 0 0 16px;
  font-size: 0.85rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 4px;
}

.breadcrumbs a {
  color: var(--muted);
}

/* アイキャッチ画像 */

.featured {
  margin: 24px 0 0;
}

.featured img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.card-with-image {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  column-gap: 20px;
}

.card-with-image > :not(.thumb) {
  grid-column: 2;
}

.thumb {
  grid-row: 1 / span 5;
  align-self: start;
}

.thumb img {
  display: block;
  width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
}

@media (max-width: 560px) {
  .card-with-image {
    grid-template-columns: minmax(0, 1fr);
  }
  .card-with-image > :not(.thumb) {
    grid-column: 1;
  }
  .thumb {
    grid-row: auto;
    margin-bottom: 12px;
  }
  .thumb img {
    width: 100%;
    height: 160px;
  }
}

.sticky {
  display: inline-block;
  margin: 0 0 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.8;
}

/* 子ページ */

.children {
  margin-top: 40px;
}

.children h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.children ul {
  margin: 0;
  padding-left: 1.25em;
}

/* ページ送りの位置 */

.pager {
  align-items: center;
  gap: 16px;
}

.pager-position {
  color: var(--muted);
  font-size: 0.875rem;
}

/* 目次: 本文の上の目次は狭い画面だけ、広い画面ではサイドバーの目次が読み進めても
   残る (sticky)。今読んでいる見出しは強調する。 */

.toc a.current {
  color: var(--primary);
  font-weight: 700;
}

.toc-side {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 0;
}

@media (min-width: 861px) {
  .layout:not(.layout-single) .entry > .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .toc-side {
    display: none;
  }
}

/* コードのコピー */

.body pre {
  position: relative;
}

.copy {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
