:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --surface-tint: #eef6f2;
  --text: #18211f;
  --muted: #64716d;
  --line: #dfe7e1;
  --accent: #0f7b63;
  --accent-strong: #0b5647;
  --accent-soft: #def1e9;
  --ink: #263238;
  --warm: #b66a3c;
  --shadow: 0 18px 50px rgba(24, 33, 31, .08);
  --shadow-strong: 0 26px 80px rgba(24, 33, 31, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 123, 99, .10), transparent 34rem),
    linear-gradient(180deg, #fbfaf7 0, var(--bg) 420px);
  color: var(--text);
  line-height: 1.72;
}

html { scroll-padding-top: 92px; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(190px, 300px);
  gap: 22px;
  align-items: center;
  padding: 16px clamp(18px, 5vw, 72px);
  background: rgba(251, 250, 247, .86);
  border-bottom: 1px solid rgba(223, 231, 225, .86);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--ink));
  color: #fff;
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand strong {
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.brand small { color: var(--muted); font-size: 12px; }

.nav, .quick-links, .tag-row, .tag-cloud, .related-list, .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nav {
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a, .quick-links a, .tag-row a, .tag-cloud a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .76);
  border-radius: 999px;
  padding: 8px 12px;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.nav a.active, .nav a:hover, .quick-links a:hover, .tag-row a:hover, .tag-cloud a:hover {
  border-color: rgba(15, 123, 99, .42);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.search {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  min-width: 0;
}
.search input, .search-page-form input, .comment-form input, .comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  padding: 11px 13px;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.search input:focus, .search-page-form input:focus, .comment-form input:focus, .comment-form textarea:focus {
  border-color: rgba(15, 123, 99, .58);
  box-shadow: 0 0 0 4px rgba(15, 123, 99, .12);
  background: #fff;
}
.search button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto 64px;
}
.page { min-width: 0; }

.hero, .page-head, .article, .comments, .panel, .post-card, .error-card {
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(223, 231, 225, .92);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(24px, 4vw, 48px);
  align-items: end;
  padding: clamp(30px, 5vw, 58px);
  margin-bottom: 24px;
  overflow: hidden;
}
.page-head {
  padding: clamp(30px, 5vw, 56px);
  margin-bottom: 24px;
}
.hero h1, .page-head h1, .article h1 {
  margin: 0;
  max-width: 820px;
  line-height: 1.1;
  letter-spacing: 0;
  font-size: clamp(32px, 5vw, 58px);
}
.hero p, .page-head p { max-width: 690px; color: var(--muted); }
.eyebrow {
  margin: 0 0 10px;
  color: var(--warm);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}
.hero-card {
  padding: 20px;
  border: 1px solid rgba(15, 123, 99, .18);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fffb, var(--accent-soft));
}
.hero-actions .button { min-width: 118px; }
.hero-card span { color: var(--accent); font-size: 13px; font-weight: 800; }
.hero-card strong { display: block; margin-top: 6px; font-size: 22px; line-height: 1.25; }
.hero-card p { margin-bottom: 0; }

.button, .comment-form button, .search-page-form button, .read-more {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ink), var(--accent-strong));
  color: #fff;
  padding: 10px 15px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.button:hover, .comment-form button:hover, .search-page-form button:hover, .read-more:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 123, 99, .18);
}
.button.ghost {
  background: #fff;
  color: var(--accent-strong);
  border: 1px solid rgba(15, 123, 99, .28);
}
button:disabled { opacity: .62; cursor: wait; }

.post-list { display: grid; gap: 18px; }
.post-card {
  position: relative;
  padding: 26px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.post-card::before {
  content: "";
  position: absolute;
  inset: 22px auto 22px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .58;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 123, 99, .32);
  box-shadow: var(--shadow-strong);
}
.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.post-card-meta > * { min-width: 0; }
.post-card-meta a { color: var(--accent-strong); }
.post-card h2 { margin: 10px 0; font-size: 27px; line-height: 1.24; letter-spacing: 0; }
.post-card p { color: var(--muted); margin: 0 0 18px; }
.post-card-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.post-card-footer .tag-row { min-width: 0; }
.tag-row a, .tag-cloud a { color: var(--accent-strong); }

.sidebar { display: grid; align-content: start; gap: 18px; }
.panel { padding: 22px; }
.profile { text-align: center; }
.avatar, .comment-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ink));
  color: #fff;
  font-weight: 800;
}
.avatar {
  width: 66px;
  height: 66px;
  margin: 0 auto 12px;
  font-size: 28px;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stats strong { display: block; font-size: 22px; }
.stats span, .profile p, .site-footer, .empty { color: var(--muted); }

.term-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.term-card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform .18s ease, border-color .18s ease;
}
.term-card:hover { transform: translateY(-2px); border-color: rgba(15, 123, 99, .4); }
.term-card strong, .term-card span { display: block; }

.archive-list { display: grid; gap: 28px; }
.archive-year { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; }
.archive-year-label {
  position: sticky;
  top: 98px;
  align-self: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.archive-year-label strong { display: block; font-size: 26px; line-height: 1.1; }
.archive-year-label span { color: var(--muted); font-size: 13px; }
.archive-items { position: relative; display: grid; gap: 12px; }
.archive-items::before {
  content: "";
  position: absolute;
  left: 75px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line);
}
.archive-item {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 16px 18px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.archive-item::before {
  content: "";
  position: absolute;
  left: 70px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.archive-item time { color: var(--muted); font-variant-numeric: tabular-nums; }
.archive-item span { font-weight: 700; }
.archive-item em {
  color: var(--accent-strong);
  font-style: normal;
  font-size: 13px;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 9px;
}

.article, .comments { padding: clamp(26px, 4vw, 52px); margin-bottom: 24px; }
.article-head { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 30px; }
.article-head .tag-row { margin-top: 18px; }
.article-body {
  max-width: 76ch;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.article-body h2, .article-body h3 { margin-top: 2em; line-height: 1.25; }
.article-body p { margin: 1.1em 0; }
.article-body blockquote {
  margin: 24px 0;
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
}
.article-body img { max-width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.article-body pre { overflow: auto; padding: 16px; background: #101828; color: #e4e7ec; border-radius: 10px; }
.article-body code { background: var(--surface-tint); padding: 2px 5px; border-radius: 5px; }
.article-body pre code { background: transparent; padding: 0; }
.related { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.related-list a {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}
.section-title h2 { margin: 0; font-size: 28px; line-height: 1.2; }
.section-title.compact h2 { font-size: 22px; }
.section-title > span {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 123, 99, .2);
  border-radius: 999px;
  padding: 6px 11px;
}
.section-action {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(15, 123, 99, .24);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 11px;
  font-size: 14px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.section-action:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: translateY(-1px);
}

.comment-form {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.comment-fields {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.comment-form label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
.comment-content-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.comment-form textarea { min-height: 126px; resize: vertical; }
.comment-content-field { grid-row: span 2; }
.comment-form-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
#commentCounter, .form-message { color: var(--muted); font-size: 14px; }
.form-message { min-height: 22px; margin: 0; }
.reply-target {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 0;
  color: var(--accent-strong);
  font-size: 14px;
}
.reply-target[hidden] { display: none; }
.reply-target > span {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 800;
}
.cancel-reply {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.cancel-reply:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: rotate(90deg);
}

.comment-list { display: grid; gap: 16px; }
.comment-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}
.comment-avatar { width: 44px; height: 44px; }
.comment-avatar.small { width: 32px; height: 32px; font-size: 13px; }
.comment-main { display: grid; gap: 8px; }
.comment-main, .reply-item > div { min-width: 0; }
.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: baseline;
}
.comment-head time { color: var(--muted); font-size: 13px; }
.comment-item p, .reply-item p { margin: 0; }
.reply-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.reply-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.comment-empty {
  display: grid;
  gap: 4px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.comment-empty strong { color: var(--text); }

.pagination { display: flex; justify-content: center; gap: 12px; margin: 24px 0; }
.pagination a, .pagination span { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.search-page-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 20px; }
.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 30px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  text-align: center;
  justify-content: space-between;
  gap: 10px 18px;
  width: 100%;
}
.copyright,
.powered-by,
.theme-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.with-love {
  color: #d14d57;
  line-height: 1;
}
.site-footer a:hover { color: var(--accent-strong); }
.back-to-top {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 30;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(15, 123, 99, .22);
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  color: var(--accent-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease, color .18s ease;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--accent-strong);
  color: #fff;
}
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { max-width: 520px; padding: 42px; text-align: center; }

@media (max-width: 980px) {
  html { scroll-padding-top: 152px; }
  .site-header {
    grid-template-columns: 1fr minmax(220px, 320px);
    gap: 14px;
  }
  .brand { grid-column: 1; }
  .search { grid-column: 2; grid-row: 1; }
  .nav {
    grid-column: 1 / -1;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .shell { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-card { max-width: 420px; }
  .post-card-footer { flex-direction: column; align-items: flex-start; }
  .comment-fields { grid-template-columns: 1fr; }
  .archive-year { grid-template-columns: 1fr; }
  .archive-year-label { position: static; }
  .archive-items::before, .archive-item::before { display: none; }
  .archive-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 190px; }
  body { line-height: 1.66; }
  .site-header {
    position: static;
    grid-template-columns: 1fr;
    padding-block: 14px;
  }
  .brand, .search, .nav { grid-column: 1; grid-row: auto; }
  .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
  .search { grid-template-columns: 1fr 42px; }
  .shell { margin-top: 22px; }
  .hero h1, .page-head h1, .article h1 {
    font-size: clamp(28px, 9vw, 42px);
  }
  .post-card h2 { font-size: 23px; }
  .article-body { font-size: 16px; }
  .section-title { align-items: flex-start; }
  .comment-content-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .reply-target > span { max-width: min(72vw, 340px); }
}

@media (max-width: 560px) {
  .shell, .site-footer { width: min(100% - 28px, 1180px); }
  .site-header { padding-inline: 14px; }
  .hero, .page-head, .article, .comments { padding: 20px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .post-card { padding: 22px; }
  .post-card::before { inset: 18px auto 18px 0; }
  .post-card-footer { align-items: stretch; }
  .read-more { width: 100%; }
  .stats { gap: 6px; }
  .stats a { min-width: 0; }
  .comment-form { padding: 14px; }
  .comment-item { grid-template-columns: 1fr; }
  .comment-avatar { width: 38px; height: 38px; }
  .reply-item { grid-template-columns: 1fr; }
  .comment-form-footer { align-items: stretch; flex-direction: column; }
  .search-page-form { grid-template-columns: 1fr; }
  .site-footer {
    gap: 8px;
  }
  .footer-inner {
    align-items: center;
    flex-direction: column;
  }
  .back-to-top {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 420px) {
  .shell, .site-footer { width: min(100% - 20px, 1180px); }
  .nav a, .quick-links a, .tag-row a, .tag-cloud a {
    padding: 7px 10px;
    font-size: 14px;
  }
  .hero, .page-head, .article, .comments, .panel, .post-card {
    border-radius: 12px;
  }
  .post-card-meta, .comment-head { gap: 6px; }
  .pagination {
    align-items: stretch;
    flex-direction: column;
  }
  .pagination a, .pagination span { text-align: center; }
}

@media (hover: none) {
  .post-card:hover,
  .term-card:hover,
  .button:hover,
  .comment-form button:hover,
  .search-page-form button:hover,
  .read-more:hover {
    transform: none;
    box-shadow: var(--shadow);
  }
}
