/* pyblog — simplified Puock look */
:root {
  --c-primary: #1c60f3;
  --c-primary-hover: #154fd1;
  --c-input-border: #d3d8df;
  --c-input-border-hover: #a9b1bc;
  --c-font: #343a40;
  --c-sub: #808695;
  --c-border: #eef0f3;
  --c-warning: #fc651f;
  --c-danger: #dc3545;
  --bg-body: #f3f5f7;
  --bg-card: #fff;
  --bg-grey: #f8f8f9;
  --bg-header: rgba(255, 255, 255, .85);
  --shadow: 0 2px 10px rgb(176 176 176 / 15%);
  --radius: 6px;
  --code-bg: #282c34;
  --code-fg: #abb2bf;
}
[data-theme="dark"] {
  --c-font: #dddbdb;
  --c-sub: #8d96a1;
  --c-border: #2f373e;
  --c-input-border: #3c4a59;
  --c-input-border-hover: #5b6b7d;
  --bg-body: #1e2a36;
  --bg-card: #1a242f;
  --bg-grey: #233140;
  --bg-header: rgba(26, 36, 47, .9);
  --shadow: 0 2px 10px rgb(23 31 40 / 57%);
  --code-bg: #141b23;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; background: var(--bg-body); color: var(--c-font);
  font: 15px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  transition: background .2s;
  overflow-x: clip; /* safety net: nothing may widen the page beyond the screen */
}
a { color: inherit; text-decoration: none; transition: color .15s; }
a:hover { color: var(--c-primary); }
img { max-width: 100%; height: auto; }
.i { width: 1em; height: 1em; fill: currentColor; vertical-align: -.125em; margin-right: 4px; }
.container {
  max-width: 1200px; margin: 0 auto;
  padding-left: max(15px, env(safe-area-inset-left)); padding-right: max(15px, env(safe-area-inset-right));
}
.muted { color: var(--c-sub); }
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 15px; }
.btn {
  display: inline-block; flex: none; border: 0; background: var(--c-primary); color: #fff; padding: 7px 18px;
  border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 1.5; white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.btn:hover { color: #fff; background: var(--c-primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.btn.ghost:hover { background: rgba(28, 96, 243, .08); color: var(--c-primary); }
.btn.block { display: block; width: 100%; }
.notice { background: rgba(28, 96, 243, .08); border-left: 3px solid var(--c-primary); padding: 8px 12px; border-radius: 4px; }
.notice.err { border-color: var(--c-danger); background: rgba(220, 53, 69, .08); }
input, textarea, select {
  font: inherit; color: var(--c-font); background: var(--bg-card); border: 1px solid var(--c-input-border);
  border-radius: 4px; padding: 7px 10px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--c-sub); opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: var(--c-input-border-hover); }
input:focus, textarea:focus, select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(28, 96, 243, .15); }
input[type=checkbox], input[type=radio] { width: auto; box-shadow: none; }

/* header */
.header {
  position: sticky; top: 0; z-index: 50; background: var(--bg-header); backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px); box-shadow: 0 1px 6px rgb(0 0 0 / 6%); margin-bottom: 20px;
}
.header-inner { display: flex; align-items: center; height: 60px; gap: 24px; }
.logo { font-size: 22px; font-weight: 700; letter-spacing: 2px; color: var(--c-primary); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 6px 12px; border-radius: 4px; white-space: nowrap; }
.nav a:hover { background: var(--bg-grey); }
.header-actions { display: flex; gap: 4px; margin-left: auto; }
.icon-btn { background: none; border: 0; color: var(--c-font); font-size: 18px; padding: 6px 8px; cursor: pointer; border-radius: 4px; }
.icon-btn:hover { background: var(--bg-grey); color: var(--c-primary); }
.icon-btn .i { margin: 0; }
.menu-btn { display: none; }
.search-bar { display: none; gap: 8px; padding-bottom: 12px; }
.search-bar.show { display: flex; }
.search-bar button {
  flex: none; border: 0; background: var(--c-primary); color: #fff; border-radius: 4px; padding: 0 20px;
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.search-bar button:hover { background: var(--c-primary-hover); }

/* layout */
.main { display: block; min-height: calc(100vh - 220px); }
.main.has-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.sidebar { position: sticky; top: 80px; }
.content, .sidebar { min-width: 0; }

/* post list */
.list-head { padding: 14px 20px; }
.list-head h1 { margin: 0; font-size: 18px; }
.list-head p { margin: 4px 0 0; color: var(--c-sub); font-size: 14px; }
.post-card { display: flex; gap: 18px; padding: 15px; transition: transform .2s, box-shadow .2s; }
.post-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / 8%); }
.post-card .thumb { flex: 0 0 220px; height: 140px; overflow: hidden; border-radius: 5px; display: block; background: var(--bg-grey); }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.post-card:hover .thumb img { transform: scale(1.08); }
.thumb-ph {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 48px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 60%), hsl(calc(var(--h) + 40) 70% 50%));
}
.post-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-card h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.5; }
.excerpt {
  margin: 0; color: var(--c-sub); font-size: 14px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--c-sub); font-size: 13px; margin-top: 8px; }
.meta .cats a + a::before { content: "/"; margin: 0 4px; color: var(--c-sub); }
.empty { padding: 40px; text-align: center; color: var(--c-sub); }
.pagination { display: flex; justify-content: center; gap: 6px; margin: 20px 0; flex-wrap: wrap; }
.pagination a, .pagination span, .pagination i {
  min-width: 36px; height: 36px; line-height: 36px; text-align: center; padding: 0 8px; border-radius: 4px;
  background: var(--bg-card); box-shadow: var(--shadow); font-style: normal;
}
.pagination .cur { background: var(--c-primary); color: #fff; }

/* sidebar */
.author-card { text-align: center; padding: 0 20px 20px; overflow: hidden; }
.author-bg { height: 90px; margin: 0 -20px; background: linear-gradient(135deg, #8a2be2 0%, #1c60f3 100%); }
.author-card h3 { margin: 6px 0 2px; }
.author-card p { margin: 0 0 12px; color: var(--c-sub); font-size: 14px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
  border-radius: 50%; color: #fff; font-weight: 600; background: hsl(var(--h) 60% 55%);
}
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.lg { width: 76px; height: 76px; font-size: 30px; margin-top: -38px; border: 4px solid var(--bg-card); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); font-size: 13px; color: var(--c-sub); }
.stats div + div { border-left: 1px solid var(--c-border); }
.stats b { display: block; font-size: 18px; color: var(--c-font); }
.widget { padding: 15px 18px; }
.widget h4 { margin: 0 0 10px; padding-left: 10px; border-left: 3px solid var(--c-primary); font-size: 15px; line-height: 1.2; }
.list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--c-border); }
.list li:last-child { border: 0; }
.list li > a { min-width: 0; }
.list.plain li a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--c-sub); font-size: 12px; background: var(--bg-grey); padding: 0 8px; border-radius: 10px; }
.list.comments li { justify-content: flex-start; align-items: flex-start; }
.list.comments div { min-width: 0; }
.list.comments b { display: block; font-size: 13px; }
.list.comments a { display: block; color: var(--c-sub); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a, .tags a { font-size: 13px; padding: 2px 10px; background: var(--bg-grey); border-radius: 12px; }

/* article */
.breadcrumb { font-size: 13px; color: var(--c-sub); margin: 0 0 10px; }
.article { padding: 25px 30px; }
.article-title { margin: 0 0 8px; font-size: 24px; line-height: 1.4; }
.article > .meta { padding-bottom: 15px; border-bottom: 1px solid var(--c-border); margin-bottom: 20px; }
.entry { font-size: 16px; line-height: 1.85; word-wrap: break-word; overflow-wrap: anywhere; }
.entry h1, .entry h2, .entry h3, .entry h4, .entry h5, .entry h6 { line-height: 1.4; margin: 1.4em 0 .6em; }
.entry h2 { font-size: 20px; padding-left: 10px; border-left: 4px solid var(--c-primary); }
.entry h3 { font-size: 18px; }
.entry p { margin: 0 0 1em; }
.entry a { color: var(--c-primary); }
.entry img { display: block; margin: 10px auto; border-radius: 4px; cursor: zoom-in; }
.entry .alignleft { float: left; margin-right: 1em; }
.entry .alignright { float: right; margin-left: 1em; }
.entry blockquote { margin: 1em 0; padding: 10px 16px; background: var(--bg-grey); border-left: 4px solid var(--c-primary); border-radius: 0 4px 4px 0; color: var(--c-sub); }
.entry blockquote p:last-child { margin: 0; }
.entry pre {
  position: relative; background: var(--code-bg); color: var(--code-fg); padding: 14px 16px; border-radius: 6px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.6; tab-size: 4;
}
.entry code { font-family: "JetBrains Mono", Menlo, Consolas, monospace; }
.entry :not(pre) > code { background: rgba(28, 96, 243, .08); color: #e83e8c; padding: 1px 5px; border-radius: 3px; font-size: .9em; }
.entry pre code { background: none; color: inherit; padding: 0; }
.copy-btn {
  position: absolute; top: 6px; right: 6px; font-size: 12px; border: 0; border-radius: 3px; padding: 2px 8px;
  background: rgba(255, 255, 255, .12); color: #ccc; cursor: pointer; opacity: 0; transition: opacity .2s;
}
.entry pre:hover .copy-btn { opacity: 1; }
.entry table { width: 100%; border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; font-size: 14px; }
.entry th, .entry td { border: 1px solid var(--c-border); padding: 6px 10px; }
.entry th { background: var(--bg-grey); }
.entry hr { border: 0; border-top: 1px dashed var(--c-border); margin: 2em 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.post-nav a { padding: 14px 18px; display: block; }
.post-nav small { display: block; color: var(--c-sub); }
.post-nav .next { text-align: right; }
.related { padding: 15px 20px; }
.related h4, .comments h4 { margin: 0 0 10px; padding-left: 10px; border-left: 3px solid var(--c-primary); line-height: 1.2; }
.related ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 30px; }
.related li { font-size: 14px; }
.related time { color: var(--c-sub); font-size: 12px; margin-left: 6px; }

/* comments */
.comments { padding: 20px; }
.comment-form textarea { resize: vertical; margin-bottom: 8px; }
.comment-form .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.comment-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.replying { margin: 0 0 6px; font-size: 14px; }
.comment-list { list-style: none; padding: 0; margin: 20px 0 0; }
.comment-list .comment-list { margin-top: 10px; padding-left: 10px; border-left: 2px solid var(--c-border); }
.comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--c-border); }
.comment .comment { border-top: 0; padding-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment-head time { color: var(--c-sub); font-size: 12px; }
.comment-head .reply { margin-left: auto; font-size: 12px; color: var(--c-sub); }
.comment-text { font-size: 14px; margin-top: 4px; word-break: break-word; }
.badge { font-size: 11px; padding: 0 6px; border-radius: 3px; background: var(--c-primary); color: #fff; }
.badge.warn { background: var(--c-warning); }

/* pages */
.page-card { padding: 25px 30px; }
.page-card h1 { margin-top: 0; font-size: 22px; }
.archive-list { list-style: none; padding: 0; margin: 0 0 20px; }
.archive-list li { padding: 5px 0; border-bottom: 1px dashed var(--c-border); }
.archive-list time { color: var(--c-sub); font-family: Menlo, monospace; margin-right: 14px; font-size: 13px; }
.error { text-align: center; padding: 60px 20px; }
.error h1 { font-size: 64px; margin: 0; color: var(--c-primary); }

.footer { text-align: center; padding: 20px 0 max(30px, env(safe-area-inset-bottom)); color: var(--c-sub); font-size: 13px; }
.footer p { margin: 4px 0; }

/* image zoom */
.zoom { position: fixed; inset: 0; z-index: 99; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.zoom img { max-width: 95vw; max-height: 95vh; }

/* ---------------------------------------------------------------- responsive
   ≥1400 wide desktop · 961–1399 desktop/laptop · 641–960 tablet & landscape phone
   ≤640 phone · ≤380 small phone */
@media (min-width: 1400px) {
  .container { max-width: 1320px; }
  .main.has-sidebar { grid-template-columns: minmax(0, 1fr) 320px; }
  .post-card .thumb { flex-basis: 240px; height: 150px; }
}
@media (max-width: 1199px) {
  .main.has-sidebar { grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; }
  .post-card .thumb { flex-basis: 190px; height: 125px; }
}
@media (max-width: 960px) {
  .main.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .header-inner { gap: 12px; }
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--bg-card); padding: 8px 15px; box-shadow: var(--shadow); }
  .nav.show { display: flex; }
  /* sidebar moves below the posts as a two-column widget grid */
  .sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; align-items: start; }
  .sidebar .card { margin-bottom: 0; }
  .sidebar .author-card { grid-column: 1 / -1; }
  /* iOS zooms into inputs smaller than 16px */
  input, textarea, select { font-size: 16px; }
}
@media (max-width: 640px) {
  .main.has-sidebar { gap: 15px; }
  .header { margin-bottom: 15px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .post-card { flex-direction: column; gap: 10px; padding: 12px; }
  .post-card .thumb { flex-basis: auto; height: auto; aspect-ratio: 16 / 9; }
  .post-card h2 { font-size: 17px; }
  .excerpt { -webkit-line-clamp: 2; }
  .article, .page-card { padding: 18px 15px; }
  .article-title { font-size: 21px; }
  .entry { font-size: 15.5px; line-height: 1.8; }
  .entry pre { margin-left: -15px; margin-right: -15px; border-radius: 0; font-size: 13px; }
  .comment-form .row { grid-template-columns: minmax(0, 1fr); }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav .next { text-align: left; }
  .related ul { columns: 1; }
  .comment-list .comment-list { padding-left: 6px; }
  .comment { gap: 10px; }
  .list-head { padding: 12px 15px; }
}
@media (max-width: 380px) {
  .container { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .logo { font-size: 20px; letter-spacing: 1px; }
  .icon-btn { padding: 6px; }
  .post-card { padding: 10px; }
  .post-card h2 { font-size: 16px; }
  .meta { gap: 2px 10px; font-size: 12px; }
  .article, .page-card { padding: 15px 12px; }
  .article-title { font-size: 19px; }
  .entry pre { margin-left: -12px; margin-right: -12px; }
  .comments { padding: 15px 12px; }
  .avatar { width: 34px; height: 34px; }
  .pagination a, .pagination span, .pagination i { min-width: 32px; height: 32px; line-height: 32px; padding: 0 6px; }
}
.notice-text { font-size: 14px; white-space: pre-line; }
.post-card h2 .badge { vertical-align: 2px; }
