/* 编程学习笔记 — design system */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;700&family=Noto+Serif+SC:wght@600;700&display=swap");

:root {
  --ink: #0c1a22;
  --ink-soft: #1e3340;
  --paper: #eef3f6;
  --paper-2: #dde6ec;
  --mist: #c5d3dc;
  --teal: #0f766e;
  --teal-bright: #14b8a6;
  --amber: #d97706;
  --amber-soft: #fbbf24;
  --muted: #5c6f7a;
  --line: rgba(12, 26, 34, 0.12);
  --code-bg: #12232e;
  --shadow: 0 18px 48px rgba(12, 26, 34, 0.12);
  --radius: 4px;
  --max: 1120px;
  --font-brand: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(20, 184, 166, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(217, 119, 6, 0.1), transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, #e4ebf0 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.site-wrap {
  position: relative;
  z-index: 1;
}

/* —— Nav —— */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
}

.nav-brand {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--teal);
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: min(92vh, 820px);
  display: grid;
  align-items: end;
  overflow: hidden;
  margin: 0 0 3rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(105deg, rgba(12, 26, 34, 0.88) 0%, rgba(12, 26, 34, 0.45) 42%, rgba(15, 118, 110, 0.35) 100%),
    url("../images/hero-notebook.svg") center / cover no-repeat,
    var(--ink);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 4rem 1.5rem 3.5rem;
  color: #f4f8fa;
}

.hero-brand {
  font-family: var(--font-brand);
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.85rem;
  letter-spacing: 0.04em;
  animation: rise 0.9s ease both;
}

.hero-lead {
  max-width: 28rem;
  margin: 0 0 1.75rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(244, 248, 250, 0.82);
  animation: rise 0.9s ease 0.12s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 0.9s ease 0.22s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--amber-soft);
  color: var(--ink);
}

.btn-primary:hover {
  background: #fcd34d;
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: #f4f8fa;
  border-color: rgba(244, 248, 250, 0.45);
}

.btn-ghost:hover {
  background: rgba(244, 248, 250, 0.1);
  color: #fff;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Sections —— */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.section-head {
  margin-bottom: 1.75rem;
}

.section-head h2 {
  font-family: var(--font-brand);
  font-size: clamp(1.55rem, 3vw, 2rem);
  margin: 0 0 0.4rem;
  letter-spacing: 0.03em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
}

/* —— Note list (interaction containers) —— */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.note-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: rise 0.7s ease both;
}

.note-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(15, 118, 110, 0.35);
  color: inherit;
}

.note-card-media {
  aspect-ratio: 16 / 9;
  background: var(--ink-soft);
  overflow: hidden;
}

.note-card-media img,
.note-card-media svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-card-body {
  padding: 1.1rem 1.15rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.note-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.note-tag {
  color: var(--teal);
  font-weight: 500;
}

.note-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.4;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  flex: 1;
}

.note-card .read-more {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--teal);
}

/* —— About strip —— */
.about-strip {
  max-width: var(--max);
  margin: 0 auto 3.5rem;
  padding: 0 1.5rem;
}

.about-strip-inner {
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .about-strip-inner {
    grid-template-columns: 1fr 1.4fr;
    gap: 2rem;
    align-items: baseline;
  }
}

.about-strip h2 {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  margin: 0;
}

.about-strip p {
  margin: 0;
  color: var(--muted);
}

/* —— Note article —— */
.article-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--teal);
}

.article-title {
  font-family: var(--font-brand);
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1.25;
  margin: 0 0 0.75rem;
  letter-spacing: 0.02em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
}

.article-cover {
  border-radius: 8px;
  overflow: hidden;
  background: var(--ink-soft);
  margin-bottom: 2rem;
  border: 1px solid var(--line);
}

.article-cover img,
.article-cover svg {
  width: 100%;
  display: block;
  aspect-ratio: 21 / 9;
  object-fit: cover;
}

.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.article-body h2 {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  margin: 2rem 0 0.75rem;
  letter-spacing: 0.02em;
}

.article-body h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.article-body p {
  margin: 0 0 1rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.1rem;
  padding-left: 1.25rem;
}

.article-body li {
  margin-bottom: 0.35rem;
}

.article-body blockquote {
  margin: 1.25rem 0;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--teal);
  background: rgba(15, 118, 110, 0.08);
  color: var(--ink-soft);
}

.figure {
  margin: 1.5rem 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.figure svg,
.figure img {
  width: 100%;
  display: block;
}

.figure-caption {
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--line);
}

pre {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  color: #e2e8f0;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(15, 118, 110, 0.1);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.tip {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 6px;
}

.tip strong {
  color: var(--amber);
}

.article-nav {
  max-width: 720px;
  margin: 0 auto 3rem;
  padding: 1.25rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.article-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

/* —— Footer —— */
.site-footer {
  margin-top: 2rem;
  padding: 2rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  background: rgba(12, 26, 34, 0.04);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner p {
  margin: 0.35rem 0;
}

.footer-brand {
  font-family: var(--font-brand);
  color: var(--ink-soft);
  font-weight: 600;
}

.beian a {
  color: var(--muted);
  text-decoration: none;
}

.beian a:hover {
  color: var(--teal);
}

/* stagger cards */
.note-card:nth-child(1) { animation-delay: 0.05s; }
.note-card:nth-child(2) { animation-delay: 0.1s; }
.note-card:nth-child(3) { animation-delay: 0.15s; }
.note-card:nth-child(4) { animation-delay: 0.2s; }
.note-card:nth-child(5) { animation-delay: 0.25s; }
.note-card:nth-child(6) { animation-delay: 0.3s; }

@media (max-width: 640px) {
  .hero {
    min-height: 78vh;
  }

  .nav-links {
    gap: 0.85rem;
  }
}
