:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e6e1d8;
  --accent: #1f6f5c;
  --accent-soft: #e5f1ed;
  --note-bg: #fbf3e2;
  --note-line: #d9a441;
  --font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513;
    --surface: #1e1c1a;
    --text: #ebe7e0;
    --muted: #a19b91;
    --line: #34312c;
    --accent: #6fc3a8;
    --accent-soft: #1f2e29;
    --note-bg: #2a2418;
    --note-line: #c99634;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513;
  --surface: #1e1c1a;
  --text: #ebe7e0;
  --muted: #a19b91;
  --line: #34312c;
  --accent: #6fc3a8;
  --accent-soft: #1f2e29;
  --note-bg: #2a2418;
  --note-line: #c99634;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--font);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
main { max-width: 720px; margin: 0 auto; padding: 8px 16px 64px; }

header.site {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 18px 16px;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.header-right { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.private {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
@media (max-width: 480px) { .private { display: none; } }
.theme {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
}
.theme button {
  display: grid; place-items: center; width: 30px; height: 26px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.theme button:hover { color: var(--text); }
.theme button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.theme button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
footer.site {
  max-width: 720px; margin: 0 auto; padding: 24px 16px 48px;
  color: var(--muted); font-size: 14px; border-top: 1px solid var(--line);
}

/* index */
.intro h1 { font-size: 30px; line-height: 1.25; margin: 16px 0 8px; letter-spacing: -0.02em; }
.intro p { color: var(--muted); margin: 0 0 20px; }
#q {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
#q:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.tag {
  font: inherit; font-size: 13px; line-height: 1.6; padding: 1px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer;
}
.meta .tag { cursor: default; margin-left: 4px; display: inline-block; white-space: nowrap; }
@media (max-width: 520px) {
  .brand { font-size: 15px; line-height: 1.3; }
  .post h1 { font-size: 26px; }
  .intro h1 { font-size: 26px; }
}
.tag[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.year { font-size: 14px; color: var(--muted); font-weight: 600; margin: 32px 0 4px; letter-spacing: 0.05em; }
.item {
  display: grid; grid-template-columns: 92px 1fr; gap: 2px 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text);
}
.item:hover .item-title { color: var(--accent); }
.item-date { grid-row: span 2; color: var(--muted); font-size: 14px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.item-title { font-weight: 600; line-height: 1.4; }
.item-sum { color: var(--muted); font-size: 15px; line-height: 1.5; }
@media (max-width: 520px) {
  .item { grid-template-columns: 1fr; }
  .item-date { grid-row: auto; }
}

/* post */
.post .meta { color: var(--muted); font-size: 14px; margin: 16px 0 4px; }
.post h1 { font-size: 32px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.02em; }
.lede { font-size: 19px; color: var(--muted); margin: 0 0 20px; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.links { font-size: 15px; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 13px; }
.chapters { margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.chapters summary { cursor: pointer; font-weight: 600; }
.chapters ol { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 15px; }
.chapters li { padding: 3px 0; }
.ts { font-variant-numeric: tabular-nums; font-size: 0.92em; text-decoration: none; margin-right: 4px; }
.ts:hover { text-decoration: underline; }

.content { font-size: 17.5px; line-height: 1.8; }
.content h2 { font-size: 22px; font-weight: 700; line-height: 1.35; margin: 40px 0 8px; letter-spacing: -0.015em; }
.content h3 { font-size: 18px; font-weight: 600; margin: 28px 0 6px; }
.content p { margin: 0 0 16px; }
.content ul, .content ol { padding-left: 22px; margin: 0 0 16px; }
.content li { margin: 4px 0; }
.content strong { font-weight: 650; }
.table { overflow-x: auto; margin: 0 0 20px; }
.content table { border-collapse: collapse; width: 100%; font-family: var(--font); font-size: 15px; }
.content th, .content td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.content th { font-weight: 650; color: var(--muted); }
.content td:last-child { font-variant-numeric: tabular-nums; }

.note {
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  background: var(--note-bg); border-left: 3px solid var(--note-line);
  border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 20px 0;
}
.note-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--note-line); margin-bottom: 4px;
}
.note p:last-child, .note ul:last-child { margin-bottom: 0; }

/* end of post: related + previous/next */
.related { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.related h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--accent); }
.card:hover .card-title { color: var(--accent); }
.card-label { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
.card-title { font-weight: 600; line-height: 1.4; }
.card-sum {
  color: var(--muted); font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-date { color: var(--muted); font-size: 13px; margin-top: auto; font-variant-numeric: tabular-nums; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pager .card:last-child:not(:first-child) { text-align: right; }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager .card { text-align: left !important; } }
