:root { color-scheme: light dark; }
body { margin: 0; padding: 2rem 1rem; font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; line-height: 1.8; background: #fafafa; color: #222; }
@media (prefers-color-scheme: dark) { body { background: #1c1c1e; color: #e6e6e6; } a { color: #8ab4f8; } }
article { max-width: 44rem; margin: 0 auto; }
h1 { font-size: 1.8rem; line-height: 1.4; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 0.75rem; padding-bottom: 0.25rem; border-bottom: 1px solid rgba(128,128,128,0.4); }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
h4 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 1rem 0; }
.lead { font-size: 1.05rem; opacity: 0.9; }
.video { position: relative; aspect-ratio: 16 / 9; margin: 1.5rem 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 6px; }
.video + .video-link { margin: -1rem 0 1.5rem; font-size: 0.9rem; text-align: right; }
blockquote { margin: 1rem 0; padding: 0.25rem 1rem; border-left: 4px solid rgba(128,128,128,0.4); opacity: 0.9; }
table { width: 100%; margin: 1.5rem 0; border-collapse: collapse; display: block; overflow-x: auto; }
th, td { border: 1px solid rgba(128,128,128,0.4); padding: 0.4rem 0.7rem; text-align: left; vertical-align: top; }
th { background: rgba(128,128,128,0.12); font-weight: 600; }
pre { overflow-x: auto; padding: 0.75rem 1rem; border-radius: 6px; background: rgba(128,128,128,0.15); }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; }
hr { border: 0; border-top: 1px solid rgba(128,128,128,0.4); margin: 2rem 0; }
.tags { margin-top: 3rem; font-size: 0.9rem; opacity: 0.75; }
.tags span { margin-right: 0.75em; }
.site-header, main, .site-footer { max-width: 44rem; margin: 0 auto; }
.site-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; padding-bottom: 1rem; margin-bottom: 2rem; border-bottom: 1px solid rgba(128,128,128,0.4); }
.site-title { font-size: 1.25rem; font-weight: 700; color: inherit; text-decoration: none; }
.site-header nav { display: flex; gap: 1rem; margin-left: auto; font-size: 0.9rem; }
.site-header nav a, .post-nav a, .tags a { color: inherit; }
.site-intro { margin: 0 0 2rem; opacity: 0.85; }
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.5rem; }
.post-link { display: block; color: inherit; text-decoration: none; }
.post-link img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 0 0 0.75rem; }
.post-title { font-size: 1.25rem; font-weight: 700; line-height: 1.5; }
.post-link:hover .post-title { text-decoration: underline; }
.post-meta { margin: 0.25rem 0 0.5rem; font-size: 0.85rem; opacity: 0.7; }
.post-excerpt { margin: 0 0 0.5rem; }
.post-list .tags { margin-top: 0.25rem; }
.post-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.5rem; margin: 3rem 0 0; padding-top: 1rem; border-top: 1px solid rgba(128,128,128,0.4); font-size: 0.9rem; }
.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.tag-cloud span, .tag-posts time { opacity: 0.7; font-size: 0.85em; }
.tag-posts { padding-left: 1.25rem; }
.site-footer { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid rgba(128,128,128,0.4); font-size: 0.8rem; opacity: 0.7; }
.search-form input { box-sizing: border-box; width: 100%; font: inherit; padding: 0.6rem 0.8rem; border: 1px solid rgba(128,128,128,0.5); border-radius: 6px; background: transparent; color: inherit; }
.search-status { margin: 0.75rem 0 1.5rem; font-size: 0.9rem; opacity: 0.7; }
.search-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.search-title { font-size: 1.1rem; font-weight: 700; }
.search-results .post-meta { margin: 0.1rem 0 0.25rem; }
.search-snippet { margin: 0; font-size: 0.92rem; opacity: 0.9; }
.search-snippet mark { background: rgba(255,200,0,0.4); color: inherit; border-radius: 2px; }
.theme-toggle { font: inherit; font-size: 0.85rem; color: inherit; background: none; border: 1px solid rgba(128,128,128,0.5); border-radius: 999px; padding: 0 0.7rem; cursor: pointer; }
/* デイ / ナイトを選んだとき（html の data-theme）。選ばなければ上の prefers-color-scheme（OS の設定）に従う。
   :where で詳しさを素の要素と同じに抑え、後に書いたこちらが勝ち、.site-header nav a などの color: inherit は崩さない */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:where(:root[data-theme="light"]) body { background: #fafafa; color: #222; }
:where(:root[data-theme="light"]) a { color: LinkText; }
:where(:root[data-theme="dark"]) body { background: #1c1c1e; color: #e6e6e6; }
:where(:root[data-theme="dark"]) a { color: #8ab4f8; }
