:root {
  --fg: #232326;
  --bg: #f7f6f2;
  --card: #ffffff;
  --muted: #6f6f76;
  --accent: #c93325;
  --accent-dark: #a8271c;
  --accent-soft: #faecea;
  --line: #e7e4db;
  --code-bg: #f4f2ec;
  --shadow: 0 1px 3px rgba(30, 25, 20, .06), 0 4px 14px rgba(30, 25, 20, .05);
  --shadow-hover: 0 2px 6px rgba(30, 25, 20, .08), 0 12px 28px rgba(30, 25, 20, .10);
  --radius: 16px;
  --side-bg: #f4f1de;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ececec;
    --bg: #131316;
    --card: #1e1e22;
    --muted: #9d9da6;
    --accent: #e86a5c;
    --accent-dark: #f08a7d;
    --accent-soft: #33201d;
    --line: #33333a;
    --code-bg: #26262c;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .4);
    --side-bg: #1e1e22;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.85;
  font-size: 1rem;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3, .card-title, .entry-title, .section-title, .page-title, .home-name {
  letter-spacing: .02em;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
/* Gradient shared by all generated eyecatches (dot pattern over vermillion→orange) */
.card-eyecatch, .entry-eyecatch {
  background:
    radial-gradient(rgba(255, 255, 255, .20) 1.2px, transparent 1.3px) 0 0 / 18px 18px,
    linear-gradient(130deg, #e0592a 0%, #c93325 52%, #8f1f14 100%);
}

/* ---------- Layout ---------- */
.layout {
  display: flex; gap: 2rem;
  max-width: 72rem; margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  align-items: flex-start;
}
.main-col { flex: 1; min-width: 0; max-width: 46rem; }

/* Avatar faces: the image itself arrives via avatar-data.css (.avatar-face) */
.avatar-img {
  display: block; border-radius: 50%;
  background-size: cover; background-position: 50% 18%; background-repeat: no-repeat;
}

/* ---------- Sidebar: the original site's navigation column, reskinned ---------- */
.sidebar {
  width: 16.5rem; flex: none;
  position: sticky; top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto; scrollbar-width: thin;
  background: var(--side-bg);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.4rem;
  font-size: .92rem; line-height: 1.6;
}
.side-logo {
  display: flex; align-items: center; gap: .6rem;
  background: #141210; color: #fff; text-decoration: none;
  border-radius: 10px; padding: .55rem .7rem; margin-bottom: 1rem;
}
.side-logo:hover { color: #fff; }
.side-logo-avatar { width: 2.2rem; height: 2.2rem; border: 2px solid rgba(255, 255, 255, .85); }
.side-logo-text {
  font-weight: 800; font-size: 1.02rem; line-height: 1.3;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
.side-links { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .4rem; }
.side-links a {
  color: var(--fg); text-decoration: none; font-weight: 600;
  padding: .22rem .4rem; border-radius: 6px;
}
.side-links a:hover { background: var(--accent-soft); color: var(--accent); }
.profile-links { display: flex; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.profile-links a {
  text-decoration: none; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem; color: var(--fg);
}
.profile-links a:hover { border-color: var(--accent); color: var(--accent); }
/* Archive (plain date navigation, kept from the original design) */
.side-star { text-align: center; margin: .4rem 0 .6rem; color: var(--muted); }
.side-year { font-weight: 800; margin-top: .8rem; }
.side-month-block { margin: .15rem 0; }
.side-month {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem;
  padding: .2rem .3rem; border-radius: 6px; font-weight: 600;
}
.side-month::-webkit-details-marker { display: none; }
.side-month::before { content: "▸"; color: var(--accent); font-size: .8rem; }
.side-month-block[open ] > .side-month::before { content: "▾"; }
.side-month:hover { background: var(--accent-soft); }
.side-count {
  margin-left: auto; background: var(--accent-soft); color: var(--accent);
  font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .05rem .5rem;
}
.side-entry {
  display: block; color: var(--accent); text-decoration: none;
  padding: .18rem .3rem .18rem 1.35rem; border-radius: 6px;
}
.side-entry:hover { background: var(--accent-soft); text-decoration: none; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
  font-size: .78rem; font-weight: 700; border-radius: 999px; padding: .15rem .6rem;
}
a.chip:hover { background: var(--accent); color: #fff; }

/* ---------- Section titles ---------- */
.section-title, .page-title {
  font-size: 1.35rem; font-weight: 800; line-height: 1.4;
  border-left: 5px solid var(--accent); padding-left: .7rem; margin: 0 0 1.1rem;
}

/* ---------- Post cards ---------- */
.card-list { display: flex; flex-direction: column; gap: 1.1rem; }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card-link { display: flex; text-decoration: none; color: var(--fg); }
.card-link:hover { color: var(--fg); }
.card-eyecatch {
  position: relative; color: #fff; overflow: hidden; flex: none;
}
.eyecatch-chip {
  position: absolute; top: .55rem; left: .55rem; z-index: 2;
  background: rgba(255, 255, 255, .94); color: #b02a1e;
  font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .12rem .55rem;
}
.eyecatch-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1;
}
.eyecatch-day { font-size: 2rem; font-weight: 800; }
.eyecatch-ym { font-size: .72rem; font-weight: 700; opacity: .9; letter-spacing: .12em; }
.eyecatch-mark {
  position: absolute; right: -.4rem; bottom: -.9rem;
  font-size: 3.2rem; opacity: .30; transform: rotate(-10deg);
}
/* compact: horizontal card with a 4:3 thumbnail */
.card-compact .card-link { gap: 1.05rem; padding: 1rem 1.15rem; align-items: stretch; }
.card-compact .card-eyecatch { width: 8.2rem; border-radius: 10px; }
.card-compact .eyecatch-center { top: 1.2rem; }
/* large: pickup card with a wide eyecatch on top */
.card-large .card-link { flex-direction: column; }
.card-large .card-eyecatch { aspect-ratio: 16 / 7; }
.card-large .eyecatch-day { font-size: 3.4rem; }
.card-large .eyecatch-ym { font-size: .85rem; }
.card-large .eyecatch-mark { font-size: 6rem; right: .4rem; bottom: -1.6rem; }
.card-large .card-body { padding: 1.15rem 1.3rem 1.25rem; }
.card-large .card-title { font-size: 1.3rem; }
.card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 1.18rem; font-weight: 800; line-height: 1.45; margin: 0 0 .35rem; }
.card-excerpt { color: var(--muted); font-size: .92rem; margin: 0 0 .6rem; }
.card-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: auto; }
.meta-date { color: var(--muted); font-size: .82rem; }
.read-more { margin-left: auto; color: var(--accent); font-size: .85rem; font-weight: 700; white-space: nowrap; }

/* ---------- Single entry ---------- */
.entry-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.9rem 1.8rem 2rem;
}
.entry-title { font-size: 1.65rem; line-height: 1.45; margin: 0 0 .6rem; }
.entry-meta {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  color: var(--muted); font-size: .88rem;
  border-bottom: 1px solid var(--line); padding-bottom: .9rem; margin: 0 0 1.4rem;
}
.entry-eyecatch {
  position: relative; height: 9rem; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  color: #fff; margin-bottom: 1.6rem;
}
.entry-eyecatch-avatar {
  width: 3.8rem; height: 3.8rem;
  border: 3px solid rgba(255, 255, 255, .94); background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.entry-eyecatch-date { font-weight: 800; font-size: 1.05rem; letter-spacing: .14em; }
.content img { max-width: 100%; height: auto; border-radius: 8px; }
.content h2 {
  font-size: 1.3rem; margin-top: 2.2rem;
  border-left: 5px solid var(--accent); padding-left: .7rem; line-height: 1.45;
}
.content h3 { font-size: 1.12rem; margin-top: 1.8rem; }
.content hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
pre { background: var(--code-bg); padding: 1rem; overflow-x: auto; border-radius: 8px; font-size: .88rem; line-height: 1.6; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }
p code, li code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
blockquote { border-left: 3px solid var(--accent); margin-left: 0; padding-left: 1rem; color: var(--muted); }

/* ---------- Author box + prev/next ---------- */
.author-box {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin-top: 1.4rem;
}
.author-avatar {
  flex: none; width: 3.8rem; height: 3.8rem; background-color: #fff;
  border: 2px solid var(--accent);
}
.author-name { font-weight: 800; margin: 0 0 .2rem; }
.author-bio { color: var(--muted); font-size: .9rem; margin: 0 0 .4rem; }
.post-nav { display: flex; gap: 1rem; margin-top: 1.4rem; }
.post-nav-item {
  flex: 1; min-width: 0; display: block; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1.1rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-nav-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.nav-older { text-align: right; }
.nav-label { display: block; font-size: .8rem; font-weight: 700; }
.nav-title {
  display: block; color: var(--fg); font-weight: 700; line-height: 1.5; margin-top: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Home: profile card + latest entry in full ---------- */
.home-profile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2.1rem 1.6rem 1.8rem;
  text-align: center; margin-bottom: 2rem;
}
.home-avatar {
  width: 7.6rem; height: 7.6rem; margin: 0 auto; background-color: #fff;
  border: 3px solid var(--accent); box-shadow: var(--shadow-hover);
}
.home-name { font-size: 1.45rem; font-weight: 800; margin: .7rem 0 .35rem; }
.home-bio { color: var(--muted); margin: 0 auto 1.1rem; max-width: 30rem; }
.home-latest-title { margin-top: 0; }
.home-more { color: var(--muted); font-size: .9rem; margin-top: 1.2rem; }

/* ---------- Related posts ---------- */
.related { margin-top: 2.2rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); color: var(--muted);
  font-size: .82rem; text-align: center;
  padding: 1.4rem 1rem 2rem;
}
.site-footer p { margin: 0; }

/* ---------- Back to top ---------- */
#to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 60;
  width: 2.9rem; height: 2.9rem; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  font-size: 1.15rem; font-weight: 800; cursor: pointer;
  box-shadow: var(--shadow-hover);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
#to-top.show { opacity: 1; pointer-events: auto; transform: none; }
#to-top:hover { background: var(--accent-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; gap: 1.25rem; padding-top: 1rem; }
  .main-col { max-width: none; width: 100%; }
  .sidebar {
    width: 100%; position: static; max-height: none; overflow: visible; order: 2;
  }

  .entry-card { padding: 1.4rem 1.1rem 1.6rem; }
  .entry-eyecatch { height: 7.5rem; }
  .post-nav { flex-direction: column; }
  .card-compact .card-link { padding: .9rem; gap: .85rem; }
  .card-compact .card-eyecatch { width: 6.4rem; }
  .card-compact .eyecatch-day { font-size: 1.55rem; }
  .card-large .card-body { padding: 1rem 1.05rem 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card, .post-nav-item, #to-top { transition: none; }
  .post-card:hover, .post-nav-item:hover { transform: none; }
}
