:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, monospace;
  --bg: #fafafa;
  --bg-hover: rgba(0, 0, 0, 0.045);
  --text: #222222;
  --text-2: #757575;
  --text-3: #b0b0b0;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #2472b5;
  --accent-soft: rgba(36, 114, 181, 0.09);
  --selection: rgba(36, 114, 181, 0.16);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg-hover: rgba(255, 255, 255, 0.055);
    --text: #e8e7e4;
    --text-2: #9b9998;
    --text-3: #626060;
    --border: rgba(255, 255, 255, 0.09);
    --accent: #529cca;
    --accent-soft: rgba(82, 156, 202, 0.14);
    --selection: rgba(82, 156, 202, 0.35);
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--selection); }

/* ---------- layout ---------- */
.page {
  display: grid;
  grid-template-columns: 1fr minmax(0, 620px) 1fr;
  padding: 56px 40px 64px;
}
.main { grid-column: 2; min-width: 0; }

/* ---------- back link (article pages) ---------- */
.back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.12s ease;
}
.back:hover { color: var(--text); }

/* ---------- note ---------- */
.note-title {
  max-width: 620px;
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.note-meta {
  max-width: 620px;
  margin: 0 0 24px;
  font-size: 12px;
  color: var(--text-3);
}
.note-content { max-width: 620px; font-size: 15px; line-height: 1.6; }
.note-title + .note-content { margin-top: 24px; }
.note-content p + p { margin-top: 1.5em; }
.note-content blockquote {
  border-left: 3px solid currentColor;
  padding-left: 0.9em;
  color: var(--text-2);
  margin-top: 0.9em;
}
.preface { color: var(--text-2); font-style: italic; }
.note-content strong { font-weight: 650; }
.note-content h2 {
  font-size: 1.25em;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 1.7em;
  margin-bottom: 1.1em;
}
a.wikilink {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.08em 0.3em;
  text-decoration: none;
  transition: background-color 0.12s ease;
}
a.wikilink:hover { text-decoration: underline; }
.note-content a:not(.wikilink):not(.note-row) {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s ease;
}
.note-content a:not(.wikilink):not(.note-row):hover { border-bottom-color: var(--accent); }

/* ---------- note list (writing/Index) ---------- */
.note-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  transition: background-color 0.1s ease;
}
.note-row:hover { background: var(--bg-hover); }
.note-row-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-row-date {
  flex-shrink: 0;
  width: 68px;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .page { display: block; padding: 32px 24px 48px; }
}
