/* 設計の本体は行長・行間・余白。日本語の字組みは Sate（エディタ）と揃える。
   色は :root 変数を上書きすれば一括で変わる構成。 */

:root {
  /* Sate の配色をそのまま採用 */
  --bg: #1a1a18;
  --fg: #d4d0c8;
  --fg-dim: #6b6860;
  --link: #8a8478;
  --rule: #3a3833;

  /* 行長（日本語で 38rem 程度） */
  --measure: 38rem;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);

  /* Sate と同一の游ゴシック系スタック。
     NOTE: Safari では游ゴシックを掴めずヒラギノに落ちる事象あり（原因調査中）。
     Tauri(WKWebView) の Sate では游ゴシックで表示される。 */
  font-family: 'YuGothic', 'Yu Gothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  line-height: 2;

  /* --- 以下、Sate の本文組版をそのまま移植 --- */

  /* 連続約物のみ詰め (chws) + カーニング。halt は単独句読点も半角化するため使わない */
  font-feature-settings: 'chws' 1, 'kern' 1;
  font-kerning: normal;

  /* 禁則処理: JIS X 4051 厳格モード — 行頭に句読点・閉じ括弧を許さない */
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;

  /* 均等割付: inter-character で和文の文字間を均等配分 */
  text-align: justify;
  text-justify: inter-character;

  /* ぶら下げ組み: 行末の句読点・閉じ括弧を行ボックス外にぶら下げ (WebKit対応) */
  hanging-punctuation: allow-end;

  /* 和欧文間スペース: 漢字⇔ラテン文字・数字間に四分アキを自動挿入 */
  text-autospace: normal;

  /* 連続約物の詰め処理 (JLREQ準拠: 段落先頭のみ全角維持) */
  text-spacing-trim: space-first;
}

/* 共通の幅・余白 */
.site-head,
main,
.site-foot {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.site-head {
  padding-top: 3rem;
  padding-bottom: 2rem;
}

.site-head a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.site-head a:hover {
  color: var(--fg);
}

main {
  padding-bottom: 4rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* 記事 */
.post {
  margin-bottom: 4rem;
}

/* 見出しはプロポーショナル詰め（Sate 準拠）。均等割付・ぶら下げは効かせない。 */
.post-title,
.post-body h2,
.post-body h3 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: normal;
  text-align: left;
  text-justify: auto;
  hanging-punctuation: none;
  font-feature-settings: 'palt' 1, 'kern' 1;
}

.post-title {
  font-size: 1.6em;
  margin: 0 0 0.5rem;
}

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

.post-title a:hover {
  color: var(--link);
}

.post-date {
  color: var(--fg-dim);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-align: left;
  margin: 0 0 2rem;
  font-variant-numeric: tabular-nums;
}

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

.post-body p {
  margin: 0 0 1.6rem;
}

.post-body h2 {
  font-size: 1.3em;
  margin: 2.5rem 0 0.8rem;
}

.post-body h3 {
  font-size: 1.1em;
  margin: 2rem 0 0.6rem;
}

.post-body a {
  color: var(--link);
}

.post-body strong {
  font-weight: 700;
}

.post-body em {
  font-style: italic;
}

.post-body del {
  text-decoration: line-through;
  color: var(--fg-dim);
}

.post-body blockquote {
  border-left: 3px solid var(--fg-dim);
  margin: 1.6rem 0;
  padding-left: 1em;
  color: var(--fg-dim);
}

.post-body code {
  font-family: 'SF Mono', 'Menlo', ui-monospace, monospace;
  font-size: 0.9em;
  background: rgba(128, 128, 128, 0.12);
  padding: 0.15em 0.3em;
  border-radius: 3px;
}

.post-body pre {
  background: rgba(128, 128, 128, 0.12);
  padding: 1rem 1.2rem;
  border-radius: 5px;
  overflow-x: auto;
  line-height: 1.6;
  text-align: left;
}

.post-body pre code {
  background: none;
  padding: 0;
}

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

.post-body hr {
  border: none;
  border-top: 1px solid var(--fg-dim);
  margin: 2.5rem 0;
}

/* リスト: Sate 同様マーカーを自前で描き本文頭と揃える */
.post-body ul,
.post-body ol {
  margin: 0 0 1.6rem;
  padding-left: 0;
  list-style: none;
}

.post-body li {
  position: relative;
  padding-left: 1.4em;
}

.post-body ul > li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg);
}

.post-body ol {
  counter-reset: site-ol;
}

.post-body ol > li {
  counter-increment: site-ol;
}

.post-body ol > li::before {
  content: counter(site-ol) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg);
}

.post-body li > p {
  margin: 0;
}

.post-body li > ul,
.post-body li > ol {
  margin: 0;
  padding-left: 1.5em;
}

/* 過去ログ */
.archive {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  margin-top: 2rem;
}

.archive ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive li {
  margin-bottom: 0.6rem;
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.archive .d {
  color: var(--fg-dim);
  font-size: 0.8rem;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.archive a {
  color: var(--fg);
  text-decoration: none;
}

.archive a:hover {
  color: var(--link);
  text-decoration: underline;
}

/* フッタ */
.site-foot {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  padding-bottom: 3rem;
  color: var(--fg-dim);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}
