:root {
  color-scheme: light dark;
  --bg: #faf9f6;
  --fg: #26272a;
  --muted: #6d6e72;
  --line: #e2e0da;
  --link: #2f5d62;
  --code: #f0eee8;
  --mark: #f3e3b3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1f;
    --fg: #e6e5e1;
    --muted: #9b9b98;
    --line: #34353a;
    --link: #9dc8b8;
    --code: #27282c;
    --mark: #5a4d24;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0 auto;
  padding: 0 16px;
  max-width: 720px;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
a { color: var(--link); text-underline-offset: 3px; }
img, video { max-width: 100%; height: auto; }
.meta, figcaption { color: var(--muted); font-size: .8125rem; }
.meta a { color: inherit; }

/* Header and footer */
.site-header { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: baseline; justify-content: space-between; padding: 32px 0 40px; }
.site-title { color: var(--fg); font-size: 1.125rem; font-weight: 700; text-decoration: none; }
.site-header nav { display: flex; gap: 16px; font-size: .875rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--fg); }
.site-footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }

/* Timeline */
.list-heading { margin: 0 0 32px; font-size: 1.5rem; }
.year { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 16px; margin-bottom: 32px; }
.year-heading { grid-column: 1; margin: 0; color: var(--muted); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.6; position: sticky; top: 12px; align-self: start; }
.entry { grid-column: 2; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding-bottom: 28px; }
.entry-thumb { display: block; }
.entry-thumb img { display: block; width: 112px; height: 72px; object-fit: cover; border-radius: 4px; }
.entry h3 { margin: 0; font-size: 1.0625rem; line-height: 1.5; }
.entry h3 a { color: var(--fg); text-decoration: none; }
.entry h3 a:hover { color: var(--link); text-decoration: underline; }
.entry-summary { display: -webkit-box; margin: 2px 0; overflow: hidden; color: var(--muted); font-size: .875rem; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.entry .meta { margin: 0; }
@media (max-width: 560px) {
  .year { display: block; }
  .year-heading { position: static; margin-bottom: 12px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .entry { grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
  .entry-thumb img { width: 80px; height: 60px; }
}

/* Paginated lists kept for existing URLs */
.summary { margin: 0 0 40px; }
.summary img { display: block; width: 100%; height: 180px; object-fit: cover; border-radius: 4px; }
.summary h2 { margin: 12px 0 0; font-size: 1.25rem; line-height: 1.4; }
.summary .meta { margin: 4px 0; }
.summary p { margin-block: 4px; }
.pagination { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; font-size: .875rem; }

/* Post */
.feature { margin: 0 0 28px; }
.feature img { display: block; width: 100%; height: auto; max-height: 240px; object-fit: cover; border-radius: 4px; }
.post > h1 { margin: 0; font-size: 1.75rem; line-height: 1.4; }
.post > .meta { margin: 8px 0 32px; }
.body h1, .body h2, .body h3, .body h4 { margin: 2em 0 .5em; line-height: 1.45; }
.body h1, .body h2 { font-size: 1.3rem; }
.body h3, .body h4 { font-size: 1.1rem; }
.body p { margin: 0 0 1.25em; }
.body blockquote { margin: 0 0 1.25em; padding-left: 16px; border-left: 3px solid var(--line); color: var(--muted); }
.body code { padding: .1em .3em; border-radius: 3px; background: var(--code); font-size: .9em; }
.body pre { overflow-x: auto; padding: 12px 14px; border-radius: 4px; background: var(--code); font-size: .875rem; line-height: 1.6; }
.body pre code { padding: 0; background: none; font-size: inherit; }
.body table { display: block; overflow-x: auto; border-collapse: collapse; }
.body th, .body td { padding: 4px 10px; border: 1px solid var(--line); }
.body figure { margin: 28px 0; }
.embed iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; }
.embed .twitter-tweet iframe, .embed iframe[src*="twitter"] { aspect-ratio: auto; height: revert-layer; }

/* Link cards */
.bookmark a { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; }
.bookmark a:hover { border-color: var(--muted); }
.bookmark a > span { display: block; grid-column: 1; }
.bookmark-title { font-size: .9375rem; font-weight: 600; line-height: 1.5; }
.bookmark-desc { display: -webkit-box !important; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: .8125rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.bookmark-meta { margin-top: 6px; color: var(--muted); font-size: .75rem; }
.bookmark-meta img { height: 1em; width: auto; margin-right: 4px; vertical-align: -.1em; }
.bookmark-meta span { margin-right: 8px; }
.bookmark-thumb { grid-column: 2; grid-row: 1 / span 3; width: 112px; height: 72px; object-fit: cover; border-radius: 4px; }
@media (max-width: 560px) {
  .bookmark-thumb { width: 72px; height: 56px; }
}

/* Share */
.share { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .875rem; }
.share a, .share button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--fg); font: inherit; line-height: 1; cursor: pointer; text-decoration: none; }
.share button[hidden] { display: none; }
.share a:hover, .share button:hover { border-color: var(--muted); }

/* Search */
mark { padding: 0 .1em; border-radius: 2px; background: var(--mark); color: inherit; }
#search-input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: inherit; font: inherit; }
