﻿/* ===== 编程笔记 — Design Tokens ===== */
:root {
  --bg: #f3f8f6;
  --bg-deep: #e4f0eb;
  --surface: #ffffff;
  --ink: #1a2e28;
  --ink-soft: #4a635a;
  --ink-muted: #7a9188;
  --accent: #1f7a65;
  --accent-hover: #165a4b;
  --accent-soft: #d4ebe3;
  --line: #c9ddd4;
  --hero-from: #1a4d42;
  --hero-to: #2d7a68;
  --hero-mist: #a8d5c4;
  --shadow: 0 1px 0 rgba(26, 46, 40, 0.04);
  --radius: 4px;
  --font-display: "Sora", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Source Serif 4", "Noto Serif SC", "Songti SC", serif;
  --font-ui: "Sora", "PingFang SC", "Microsoft YaHei", sans-serif;
  --max: 720px;
  --wide: 1080px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(168, 213, 196, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 5%, rgba(196, 220, 230, 0.35), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ===== Layout ===== */
.wrap {
  width: min(100% - 2.5rem, var(--wide));
  margin-inline: auto;
}

.wrap--narrow {
  width: min(100% - 2.5rem, var(--max));
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(243, 248, 246, 0.85);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(243, 248, 246, 0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo:hover {
  color: var(--accent);
}

.logo-mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--hero-mist));
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
}

.nav a:hover::after,
.nav a.is-active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.85rem;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: min(72vh, 560px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin-bottom: 3.5rem;
  color: #f5faf8;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(26, 77, 66, 0.92) 0%, rgba(45, 122, 104, 0.75) 45%, rgba(26, 77, 66, 0.55) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23a8d5c4' stroke-opacity='0.12' stroke-width='1'%3E%3Cpath d='M0 40h80M40 0v80'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, var(--hero-from), var(--hero-to));
  background-size: cover, 48px 48px, cover;
}

.hero-bg::after {
  content: "";
  position: absolute;
  right: -8%;
  bottom: -20%;
  width: 55%;
  height: 90%;
  background:
    radial-gradient(ellipse at center, rgba(168, 213, 196, 0.35) 0%, transparent 70%);
  animation: drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-4%, -6%) scale(1.08); }
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 4rem 0 3.25rem;
  animation: riseIn 0.8s ease-out both;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.hero-lead {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: rgba(245, 250, 248, 0.88);
  max-width: 28rem;
  margin-bottom: 1.75rem;
  font-weight: 400;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.btn--light {
  background: #f5faf8;
  color: var(--hero-from);
}

.btn--light:hover {
  background: #fff;
  color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 0.55rem 1.1rem;
}

.btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ===== Sections ===== */
main {
  flex: 1;
}

.section {
  padding-bottom: 4rem;
}

.section-head {
  margin-bottom: 2rem;
  animation: riseIn 0.7s ease-out 0.15s both;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.section-desc {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* ===== Post list ===== */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: riseIn 0.7s ease-out 0.28s both;
}

.post-item {
  border-top: 1px solid var(--line);
  transition: background 0.2s ease;
}

.post-item:last-child {
  border-bottom: 1px solid var(--line);
}

.post-item a {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0.5rem;
  color: inherit;
  align-items: baseline;
}

.post-item a:hover {
  background: rgba(255, 255, 255, 0.45);
}

.post-item a:hover .post-item-title {
  color: var(--accent);
}

.post-date {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.post-item-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  transition: color 0.2s ease;
}

.post-item-excerpt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 0.02em;
}

/* ===== Article ===== */
.article-hero {
  padding: 2.5rem 0 1.5rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-lead {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 2rem;
}

.article-body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--ink);
  padding-bottom: 3rem;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 2.25rem 0 0.85rem;
  color: var(--ink);
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.65rem;
}

.article-body p {
  margin-bottom: 1.15rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.15rem 1.35rem;
}

.article-body li {
  margin-bottom: 0.4rem;
}

.article-body code {
  font-family: "Consolas", "SF Mono", "Cascadia Code", monospace;
  font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 0.12em 0.4em;
  border-radius: 3px;
}

.article-body pre {
  background: #1a2e28;
  color: #d4ebe3;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1.35rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.85rem 1.15rem;
  background: rgba(255, 255, 255, 0.55);
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.article-nav a {
  color: var(--ink-soft);
}

.article-nav a:hover {
  color: var(--accent);
}

/* ===== About ===== */
.page-hero {
  padding: 2.75rem 0 2rem;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-hero p {
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 1.1rem;
  max-width: 36rem;
}

.about-content {
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding-bottom: 3.5rem;
}

.about-content p {
  margin-bottom: 1.15rem;
  color: var(--ink);
}

.about-content h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 650;
  margin: 2rem 0 0.75rem;
}

.skill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-soft);
}

.beian {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.beian:hover {
  color: var(--accent);
}

.beian-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
}

.beian-police {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.beian-police img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.beian-police:hover {
  color: var(--accent);
}

/* ===== Reveal on scroll ===== */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .wrap {
    width: min(100% - 1.5rem, var(--wide));
  }

  .nav-toggle {
    display: block;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(243, 248, 246, 0.98);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1.25rem 1rem;
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: 0.65rem 0;
  }

  .post-item a {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 1.25rem 0.25rem;
  }

  .hero {
    min-height: min(62vh, 420px);
  }

  .hero-content {
    padding: 3rem 0 2.5rem;
  }

  .article-nav {
    flex-direction: column;
  }
}
