/* Ivan Blog — 现代排版层（覆盖在 responsive.css 之后，不动模板结构） */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --code-bg: #f3f4f6;
  --radius: 12px;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #161a20;
    --text: #e6e6e6;
    --muted: #9aa3af;
    --border: #262b33;
    --accent: #7aa2ff;
    --code-bg: #1b2028;
  }
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg) !important;
  color: var(--text);
}

a {
  color: inherit;
}

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

.container,
.welcome,
footer {
  max-width: var(--maxw);
}

.header {
  background: var(--surface);
  border-bottom-color: var(--border);
}

.logo {
  letter-spacing: -0.02em;
}

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

.nav a:hover {
  color: var(--text);
}

.post-card {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius);
}

.post-title {
  letter-spacing: -0.015em;
  line-height: 1.28;
}

.post-meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-preview {
  color: var(--muted);
}

.read-more {
  color: var(--accent);
  font-weight: 600;
}

.welcome p,
footer {
  color: var(--muted);
}

/* 文章正文 */
.content {
  font-size: 17px;
  line-height: 1.85;
}

.content h2,
.content h3 {
  line-height: 1.3;
  margin-top: 2em;
  letter-spacing: -0.01em;
}

.content p {
  margin: 0 0 1.1em;
}

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

.content blockquote {
  margin: 1.4em 0;
  padding: 0.2em 1em;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.content code {
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}

.content pre {
  background: var(--code-bg);
  padding: 1em;
  border-radius: 10px;
  overflow: auto;
}

.content pre code {
  background: none;
  padding: 0;
}

.content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .header,
  .nav,
  footer {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* 评论区 */
.comments {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

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

.comment-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.comment-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.comment-head strong {
  color: var(--text);
  font-size: 15px;
}

.reply-to {
  color: var(--accent);
  font-size: 13px;
}

.comment-head time {
  margin-left: auto;
  font-size: 12px;
  white-space: nowrap;
}

.comment-body {
  margin-top: 8px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form h3 {
  font-size: 17px;
  margin: 0 0 12px;
}

.comment-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-row input {
  flex: 1;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.comment-form textarea {
  resize: vertical;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.comment-form button {
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 12px 0;
  background: var(--code-bg);
}

.flash.error {
  border-left: 3px solid #c0392b;
}

.flash.ok {
  border-left: 3px solid #2e7d32;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

@media (max-width: 600px) {
  .comment-row {
    flex-direction: column;
  }
}

/* 移动端防护：任何元素都不撑破视口 */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

.content,
.post-preview,
.comment-body {
  overflow-wrap: anywhere;
}
