:root {
  --bg: #f4efe6;
  --bg-soft: rgba(255, 255, 255, 0.66);
  --surface: rgba(255, 251, 245, 0.84);
  --surface-strong: #fffdf8;
  --card-dark: #12202a;
  --card-dark-soft: #1a2d39;
  --text: #17202a;
  --muted: #5d6873;
  --line: rgba(23, 32, 42, 0.1);
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-warm: #c2410c;
  --shadow: 0 24px 60px rgba(20, 29, 36, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-body: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-title: "Noto Serif CJK SC", "Songti SC", "STSong", serif;
  --font-code: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(194, 65, 12, 0.14), transparent 24%),
    linear-gradient(180deg, #f8f3eb 0%, #f3ede4 44%, #f8f4ed 100%);
  font-family: var(--font-body);
  line-height: 1.7;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 92%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.7);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(20, 29, 36, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--card-dark), var(--card-dark-soft));
  color: #dffcf4;
  font-family: var(--font-code);
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 700;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.82rem;
}

.site-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), transparent);
  transition: transform 180ms ease;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}

.section {
  margin-top: 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 28px;
  align-items: stretch;
  padding-top: 56px;
}

.hero-copy,
.terminal-card,
.signal-card,
.post-card,
.stack-panel,
.about-panel {
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.84), rgba(255, 249, 242, 0.76));
}

.eyebrow,
.signal-label,
.section-note,
.post-meta,
.about-item span {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1,
.section-heading h2,
.lab-copy h2,
.about-copy h2 {
  margin: 12px 0 18px;
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  max-width: 10ch;
}

.hero-text,
.lab-copy p,
.about-copy p,
.signal-card p,
.post-card p,
.series-copy p {
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.button:hover,
.button:focus-visible,
.post-card:hover,
.series-item:hover,
.signal-card:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f7fffd;
  box-shadow: 0 18px 30px rgba(15, 118, 110, 0.22);
}

.button.secondary {
  border: 1px solid rgba(23, 32, 42, 0.12);
  background: rgba(255, 255, 255, 0.54);
}

.hero-points {
  display: grid;
  gap: 12px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.hero-points li {
  position: relative;
  padding-left: 20px;
  color: var(--text);
}

.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
}

.terminal-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #0d1820, #15242f);
  color: #d7efe7;
}

.terminal-card::before {
  content: "";
  position: absolute;
  inset: auto -10% -35% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.24), transparent 70%);
}

.terminal-header {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.terminal-header span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.terminal-header span:nth-child(1) {
  background: #ff6f61;
}

.terminal-header span:nth-child(2) {
  background: #f4b400;
}

.terminal-header span:nth-child(3) {
  background: #34a853;
}

.terminal-body {
  position: relative;
  display: grid;
  gap: 10px;
  font-family: var(--font-code);
  font-size: 0.96rem;
  line-height: 1.65;
}

.prompt,
.stack-code span,
.series-index {
  color: #66d9c2;
}

.rotating-phrase {
  color: #ffe4b5;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 26px;
}

.signal-card {
  padding: 28px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.signal-card h2,
.series-copy h3,
.post-card h3 {
  margin: 10px 0 14px;
  font-size: 1.3rem;
  line-height: 1.3;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.section-heading h2,
.lab-copy h2,
.about-copy h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.section-note {
  max-width: 30ch;
  text-align: right;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.88), rgba(255, 248, 240, 0.76));
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.post-card.featured {
  grid-column: span 2;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.9), rgba(255, 246, 236, 0.82));
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--accent-strong);
  font-weight: 600;
}

.text-link::after {
  content: "->";
  font-family: var(--font-code);
}

.series-list {
  display: grid;
  gap: 16px;
}

.series-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 26px 28px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.72);
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
}

.series-index {
  font-family: var(--font-code);
  font-size: 1.6rem;
}

.lab-section,
.about-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.lab-copy,
.about-copy {
  padding: 34px;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.stack-panel,
.about-panel {
  padding: 30px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(19, 35, 45, 0.96), rgba(24, 40, 52, 0.94));
  color: #edf6f3;
}

.stack-code {
  font-family: var(--font-code);
  color: #d6efe8;
}

.stack-list {
  display: grid;
  gap: 16px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.stack-list li,
.about-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.stack-list li:first-child,
.about-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.stack-list span {
  color: rgba(214, 239, 232, 0.64);
  font-family: var(--font-code);
  font-size: 0.88rem;
}

.stack-list strong,
.about-item strong {
  font-size: 1rem;
  line-height: 1.6;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dffcf4;
  font-size: 0.84rem;
}

.site-footer {
  margin-top: 60px;
  padding: 28px 0 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

code {
  font-family: var(--font-code);
}

pre {
  font-family: var(--font-code);
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 560ms ease,
    transform 560ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-cta {
  margin-top: 26px;
}

.archive-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 340px;
  gap: 24px;
  align-items: stretch;
  padding-top: 48px;
}

.archive-copy,
.archive-panel,
.note-card,
.error-card {
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.archive-copy,
.archive-panel,
.note-card {
  padding: 32px;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.78);
}

.archive-copy h1,
.error-card h1 {
  margin: 10px 0 18px;
  font-family: var(--font-title);
  font-size: clamp(2.3rem, 4.8vw, 4.4rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.archive-lead,
.note-card p,
.error-text {
  color: var(--muted);
  font-size: 1.04rem;
}

.archive-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(180deg, #12212a, #1b2d38);
  color: #ecf7f4;
}

.archive-panel .eyebrow,
.note-card.dark .eyebrow {
  color: rgba(236, 247, 244, 0.68);
}

.archive-points {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 18px;
}

.archive-points li {
  color: rgba(236, 247, 244, 0.84);
}

.topic-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--accent-strong);
  font-size: 0.84rem;
}

.archive-grid .post-card.featured {
  min-height: 100%;
}

.archive-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.note-card.dark {
  background: linear-gradient(180deg, #12212a, #1b2d38);
  color: #edf6f3;
}

.note-card.dark p {
  color: rgba(237, 246, 243, 0.78);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--accent-strong);
  font-weight: 600;
}

.article-page .page-shell {
  width: min(1240px, calc(100% - 32px));
}

.article-hero {
  padding-top: 48px;
}

.article-hero-copy {
  padding: 40px 44px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(255, 248, 240, 0.8));
  box-shadow: var(--shadow);
}

.article-hero h1 {
  margin: 10px 0 18px;
  font-family: var(--font-title);
  font-size: clamp(2.4rem, 4.6vw, 4.6rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  max-width: 12ch;
}

.article-lead {
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.article-meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.article-meta-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.52);
}

.article-meta-card span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-meta-card strong {
  font-size: 0.98rem;
}

.article-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.article-sidebar {
  position: sticky;
  top: 108px;
  display: grid;
  gap: 16px;
}

.toc-card,
.mini-panel {
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.78);
  box-shadow: var(--shadow);
}

.toc-card nav {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.toc-card a {
  color: var(--muted);
  font-size: 0.96rem;
}

.toc-card a:hover,
.toc-card a:focus-visible {
  color: var(--accent-strong);
}

.mini-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.article-content {
  padding: 36px 40px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.84);
  box-shadow: var(--shadow);
}

.prose section + section {
  margin-top: 42px;
}

.prose h2,
.article-endcap h3 {
  margin: 0 0 16px;
  font-family: var(--font-title);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.24;
  letter-spacing: -0.03em;
}

.prose p,
.prose li {
  color: var(--text);
  font-size: 1.02rem;
}

.prose ul {
  margin: 18px 0;
  padding-left: 20px;
}

.prose li + li {
  margin-top: 10px;
}

.prose pre {
  overflow-x: auto;
  margin: 22px 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, #10202a, #162a35);
  color: #dcf7ef;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.prose code {
  font-family: var(--font-code);
  font-size: 0.94em;
}

.prose :not(pre) > code {
  padding: 0.16em 0.45em;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

.callout,
.callout.subtle {
  margin: 22px 0;
  padding: 18px 20px;
  border-radius: 18px;
}

.callout {
  border-left: 4px solid var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.callout.subtle {
  border-left: 4px solid var(--accent-warm);
  background: rgba(194, 65, 12, 0.08);
}

.check-list {
  padding-left: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 26px;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
}

.article-endcap {
  margin-top: 44px;
  padding: 28px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 32%),
    rgba(255, 255, 255, 0.56);
}

.article-endcap .button {
  margin-top: 12px;
}

.error-page {
  min-height: 100vh;
}

.error-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.error-main {
  width: min(760px, 100%);
}

.error-card {
  padding: 44px;
  border-radius: 32px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.9), rgba(255, 247, 239, 0.84));
  text-align: center;
}

.status-code {
  margin: 0;
  color: var(--accent-strong);
  font-family: var(--font-code);
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: 1;
}

.error-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

@media (max-width: 980px) {
  .site-header,
  .section-heading,
  .hero,
  .lab-section,
  .about-section,
  .archive-hero,
  .archive-notes {
    grid-template-columns: 1fr;
  }

  .site-header,
  .section-heading {
    align-items: flex-start;
  }

  .hero {
    padding-top: 34px;
  }

  .signal-grid,
  .post-grid {
    grid-template-columns: 1fr 1fr;
  }

  .article-meta-row,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    position: static;
  }

  .post-card.featured {
    grid-column: span 2;
  }

  .section-note {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 28px;
  }

  .site-nav {
    gap: 14px;
  }

  .hero-copy,
  .terminal-card,
  .signal-card,
  .post-card,
  .lab-copy,
  .stack-panel,
  .about-copy,
  .about-panel,
  .archive-copy,
  .archive-panel,
  .note-card,
  .article-hero-copy,
  .toc-card,
  .mini-panel,
  .article-content,
  .article-endcap,
  .error-card {
    padding: 24px;
  }

  .signal-grid,
  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-card.featured {
    grid-column: auto;
  }

  .series-item {
    grid-template-columns: 1fr;
  }

  .section {
    margin-top: 46px;
  }

  .hero h1 {
    max-width: none;
  }

  .article-hero h1 {
    max-width: none;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
