/* 代码之间 · sunnb.site */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1a1a18;
  --muted: #5c5c56;
  --line: #e4e2db;
  --accent: #0f6b5c;
  --accent-soft: #e6f3f0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26, 26, 24, 0.04), 0 8px 24px rgba(26, 26, 24, 0.04);
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
  --max: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: #0a4f44;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.wrap {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding-block: 0.75rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.brand-domain {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.92rem;
}

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

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
}

/* Main */
main {
  flex: 1 0 auto;
  width: 100%;
  padding-block: 2.75rem 4rem;
}

.hero {
  margin-bottom: 2.75rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Post card / list */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.post-card {
  display: block;
  padding: 1.35rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-1px);
  color: inherit;
}

.post-card:active {
  transform: translateY(0);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.post-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.35;
}

.post-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Article page */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.article-header h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.65rem, 3.5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.article-body {
  font-size: 1.05rem;
}

.article-body p {
  margin: 0 0 1.15rem;
}

.article-body h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 650;
}

.article-body ul {
  margin: 0 0 1.15rem;
  padding-left: 1.25rem;
}

.article-body li {
  margin-bottom: 0.4rem;
}

.article-body li::marker {
  color: var(--accent);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.12em 0.35em;
  background: var(--accent-soft);
  border-radius: 4px;
  color: #0a4f44;
}

.article-body pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: #1e2422;
  color: #e8eeec;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
}

.article-body pre code {
  padding: 0;
  background: none;
  color: inherit;
  border-radius: 0;
}

.article-body blockquote {
  margin: 0 0 1.25rem;
  padding: 0.75rem 0 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-block: 1.75rem 2rem;
  background: var(--surface);
}

.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.beian {
  color: var(--muted);
  text-decoration: none;
}

.beian:hover {
  color: var(--accent);
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

@media (max-width: 520px) {
  .wrap {
    width: min(100% - 1.75rem, var(--max));
  }

  main {
    padding-block: 2rem 3rem;
  }

  .post-card {
    padding: 1.15rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .post-card {
    transition: none;
  }

  .post-card:hover {
    transform: none;
  }
}
