:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --fg: #1d2524;
  --muted: #68716e;
  --line: #ddd6c8;
  --panel: #fffdfa;
  --panel-strong: #efe8da;
  --accent: #0f6b5f;
  --accent-strong: #0a4b43;
  --warm: #b25b35;
  --shadow: 0 18px 50px rgba(38, 48, 45, 0.1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 107, 95, 0.09), transparent 32rem),
    linear-gradient(180deg, #fbf8f1 0%, var(--bg) 36rem);
  color: var(--fg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  line-height: 1.75;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.nav {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 15px;
}

.nav a { color: var(--muted); }
.nav .brand {
  margin-right: auto;
  color: var(--fg);
  font-weight: 800;
  letter-spacing: 0;
}

.nav .admin-entry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  opacity: 0.52;
}

.nav .admin-entry:hover,
.nav .admin-entry:focus-visible { opacity: 1; }

.nav .admin-entry svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.hero {
  padding: 0 0 40px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: 32px;
}

.section-kicker {
  margin: 0 0 12px;
  color: var(--warm);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(56px, 10vw, 128px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
  color: var(--fg);
  font-weight: 750;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.sitebar {
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.86);
  backdrop-filter: blur(12px);
}

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.wrap.compact {
  max-width: 900px;
}

.wrap h1 {
  margin: 0 0 28px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.04;
}

.intro {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 48px;
  padding: 0 0 54px;
  border-bottom: 1px solid var(--line);
}

.intro h2,
.section-head h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.intro > p {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
}

.section { padding-top: 54px; }

.home-latest { padding-top: 0; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.text-link {
  color: var(--accent);
  font-weight: 750;
}

.post-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  min-height: 260px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.post-top,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.post-card h3 {
  margin: 16px 0 10px;
  font-size: 25px;
  line-height: 1.22;
}

.post-card p {
  margin: 0;
  color: var(--muted);
  flex: 1;
}

.meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.meta {
  margin-top: 22px;
}

.meta a,
.tag-row a {
  color: var(--accent);
  font-weight: 700;
}

.article-layout {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 90px;
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 760px) minmax(120px, 240px);
  gap: 44px;
  justify-content: center;
}

.article {
  grid-column: 2;
  min-width: 0;
}

.article header {
  padding-bottom: 28px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.article h1 {
  margin: 12px 0 16px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.08;
}

.summary {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.article h2 {
  margin-top: 44px;
  font-size: 30px;
  line-height: 1.25;
  scroll-margin-top: 92px;
}

.article h3 {
  margin-top: 30px;
  font-size: 23px;
  scroll-margin-top: 92px;
}

.article p,
.article li {
  color: #33403d;
  font-size: 18px;
}

.article a {
  color: var(--accent);
  border-bottom: 1px solid rgba(15, 107, 95, 0.28);
}

.article blockquote {
  margin: 28px 0;
  padding: 2px 0 2px 20px;
  border-left: 4px solid var(--warm);
  color: var(--muted);
}

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article pre {
  overflow: auto;
  padding: 18px;
  background: #182321;
  color: #eef8f4;
  border-radius: 8px;
}

.article code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.article-footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.article-footer strong {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.comments {
  margin-top: 54px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.comments-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.comments h2 {
  margin: 0;
  font-size: 28px;
}

.comments-head span,
.comment-actions span {
  color: var(--muted);
  font-size: 14px;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.comment-empty {
  justify-self: start;
  max-width: 100%;
  margin: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.comment-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.comment-item header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0 0 8px;
  border: 0;
  color: var(--muted);
  font-size: 14px;
}

.comment-item strong {
  color: var(--fg);
}

.comment-item p {
  margin: 0;
  white-space: pre-wrap;
}

.comment-form {
  display: grid;
  gap: 12px;
}

.comment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--fg);
  font: inherit;
}

.comment-form input {
  height: 42px;
  padding: 0 12px;
}

.comment-form textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.comment-form .hp {
  display: none;
}

.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.comment-actions button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 750;
}

.toc {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 24px;
  align-self: start;
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.toc strong {
  display: block;
  margin-bottom: 12px;
}

.toc a {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.toc .lv3 { padding-left: 12px; }

.timeline {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.timeline article {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 26px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.timeline time {
  color: var(--muted);
  font-size: 14px;
}

.timeline h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.timeline p {
  grid-column: 2;
  margin: -8px 0 0;
  color: var(--muted);
}

.recent-notes {
  border-top: 1px solid var(--line);
}

.recent-note-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.recent-note {
  min-width: 0;
  padding-left: 18px;
  border-left: 2px solid var(--line);
}

.recent-note time,
.note-time,
.note-occurred,
.note-permalink {
  color: var(--muted);
  font-size: 14px;
}

.recent-note .note-content {
  max-height: 11em;
  overflow: hidden;
}

.notes-wrap {
  max-width: 820px;
}

.notes-wrap h1 {
  margin-bottom: 0;
}

.about-page {
  min-height: calc(100vh - 142px);
  display: flex;
  flex-direction: column;
  padding-bottom: 26px;
}

.about-intro {
  padding: 4px 0 42px;
  border-bottom: 1px solid var(--line);
}

.about-intro > h2,
.subscriptions h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.about-content {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 19px;
}

.about-content > :first-child {
  margin-top: 0;
}

.about-content > :last-child {
  margin-bottom: 0;
}

.about-content a {
  color: var(--accent);
  border-bottom: 1px solid rgba(15, 107, 95, 0.28);
}

.about-content h2 {
  margin: 30px 0 12px;
  color: var(--fg);
  font-size: 24px;
  line-height: 1.3;
}

.about-content h3 {
  margin: 24px 0 10px;
  color: var(--fg);
  font-size: 19px;
}

.about-content p,
.about-content ul,
.about-content ol,
.about-content blockquote {
  margin: 12px 0;
}

.about-content blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--warm);
}

.about-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.about-intro .about-since {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.subscriptions {
  margin-top: auto;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 28px;
}

.subscriptions h2 {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.subscription-list {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 12px 26px;
}

.subscription-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.subscription-list strong {
  color: var(--accent);
  font-size: 14px;
}

.subscription-list small {
  color: var(--muted);
  font-size: 12px;
}

.notes-timeline {
  border-top: 1px solid var(--line);
}

.note-entry {
  position: relative;
  padding: 28px 0 32px 24px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.note-entry::before {
  content: "";
  position: absolute;
  top: 35px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.note-time {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.note-content {
  color: #33403d;
  font-size: 17px;
}

.note-content > :first-child {
  margin-top: 0;
}

.note-content > :last-child {
  margin-bottom: 0;
}

.note-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.note-media-grid {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.note-media-2,
.note-media-3,
.note-media-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.note-media-grid img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  max-height: 360px;
  object-fit: cover;
}

.note-media-1 img {
  max-height: 560px;
}

.note-content blockquote {
  margin: 18px 0;
  padding-left: 16px;
  border-left: 3px solid var(--warm);
  color: var(--muted);
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
  color: var(--accent);
  font-size: 14px;
}

.note-permalink {
  display: inline-block;
  margin-top: 12px;
}

.note-detail {
  max-width: 720px;
}

.note-detail .note-entry {
  margin-bottom: 24px;
}

.note-occurred {
  margin: -4px 0 12px;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
}

.pagination a:last-child {
  text-align: right;
}

.empty-state {
  padding: 36px 0;
  color: var(--muted);
}

.not-found {
  min-height: calc(100vh - 72px);
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.not-found h1 {
  margin: 0 0 12px;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 1;
}

.not-found p {
  color: var(--muted);
  font-size: 20px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px;
  background: rgba(255, 253, 250, 0.62);
}

.footer-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 13px;
}

.footer-inner a {
  color: var(--muted);
}

.footer-inner a:hover {
  color: var(--accent);
}

@media (max-width: 920px) {
  .intro,
  .timeline article {
    display: block;
  }

  .article-layout {
    width: min(820px, calc(100% - 40px));
    display: block;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .recent-note-list {
    grid-template-columns: 1fr;
  }

  .comment-grid {
    grid-template-columns: 1fr;
  }

  .toc {
    display: none;
  }

  .intro > p {
    margin-top: 16px;
  }

  .timeline p {
    margin-top: 6px;
  }
}

@media (max-width: 560px) {
  .nav {
    width: min(100% - 28px, 1120px);
    gap: 14px;
    font-size: 14px;
  }

  .hero-inner,
  .wrap,
  .article-layout,
  .not-found {
    width: calc(100% - 28px);
  }

  .button {
    justify-content: center;
  }

  .subscriptions {
    align-items: flex-start;
    gap: 18px;
  }

  .subscription-list {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
