:root {
  --bg: #f5efe8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --ink: #1f262d;
  --muted: #59616d;
  --line: rgba(31, 38, 45, 0.14);
  --blue: #1d6f97;
  --blue-strong: #165777;
  --copper: #b7673f;
  --sand: #d6bf95;
  --shadow: 0 18px 40px rgba(16, 34, 43, 0.12);
  --radius: 18px;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.65;
  background:
    radial-gradient(circle at 12% 12%, rgba(183, 103, 63, 0.16), transparent 38%),
    radial-gradient(circle at 86% 18%, rgba(29, 111, 151, 0.16), transparent 34%),
    radial-gradient(circle at 50% 108%, rgba(214, 191, 149, 0.16), transparent 42%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(29, 111, 151, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 111, 151, 0.06) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at 50% 35%, black 28%, transparent 78%);
  opacity: 0.32;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  right: -10vw;
  bottom: -12vh;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  background:
    conic-gradient(
      from 180deg,
      rgba(29, 111, 151, 0.1),
      rgba(183, 103, 63, 0.12),
      rgba(214, 191, 149, 0.08),
      rgba(29, 111, 151, 0.1)
    );
  filter: blur(26px);
  opacity: 0.78;
  pointer-events: none;
  z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(-3vw, -2vh, 0) scale(1.06);
  }
}

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

.blog-topbar,
.blog-main,
.blog-footer {
  width: min(var(--max-width), calc(100% - 2rem));
  position: relative;
  z-index: 1;
}

.blog-topbar {
  position: sticky;
  top: 0.8rem;
  margin: 1rem auto 0;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(16, 34, 43, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.blog-topbar-menu {
  display: contents;
}

.blog-nav,
.lang-switch,
.blog-topbar-actions,
.post-meta,
.article-card-actions,
.footer-actions,
.article-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.blog-nav,
.blog-topbar-actions {
  min-width: 0;
  padding: 0.18rem;
  border: 1px solid rgba(31, 38, 45, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.blog-nav {
  flex: 1 1 23rem;
  justify-content: flex-start;
}

.blog-topbar-actions {
  flex: 1 1 14rem;
  justify-content: flex-end;
}

.blog-link,
.lang-btn,
.meta-pill,
.article-link,
.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 180ms ease, border-color 180ms ease, color 180ms ease;
  white-space: nowrap;
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 180ms ease, background 180ms ease;
}

.mobile-menu-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(16, 34, 43, 0.08);
}

.mobile-menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.blog-topbar.is-menu-open .mobile-menu-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.blog-topbar.is-menu-open .mobile-menu-toggle span:nth-child(2) {
  opacity: 0;
}

.blog-topbar.is-menu-open .mobile-menu-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.blog-link:hover,
.lang-btn:hover,
.meta-pill:hover,
.article-link:hover,
.footer-link:hover {
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(16, 34, 43, 0.08);
}

.blog-link.is-current,
.blog-link[aria-current="page"],
.blog-link.blog-link-cta,
.footer-link.footer-link-cta,
.lang-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, var(--blue), var(--copper));
  box-shadow: 0 12px 22px rgba(29, 111, 151, 0.2);
}

.lang-switch {
  padding: 0.16rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

.lang-btn {
  min-height: 34px;
  min-width: 48px;
  padding: 0.32rem 0.62rem;
  cursor: pointer;
}

.blog-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.06rem;
  font-weight: 700;
  flex: 0 1 auto;
  max-width: min(100%, 18rem);
  padding: 0 0.35rem;
  text-align: center;
}

.blog-main {
  margin: 1.3rem auto 2.8rem;
  display: grid;
  gap: 2rem;
}

body[data-lang="en"] .lang-zh,
body[data-lang="zh"] .lang-en {
  display: none !important;
}

body[data-lang="zh"] .lang-zh {
  display: revert;
}

body[data-lang="en"] .lang-en {
  display: revert;
}

.hero,
.article-card,
.theme-card,
.contact-panel,
.post-header,
.post-section,
.repo-panel,
.related-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero > *,
.article-card > *,
.theme-card > *,
.contact-panel > *,
.post-header > *,
.post-section > *,
.repo-panel > *,
.related-card > * {
  position: relative;
  z-index: 1;
}

.hero {
  padding: clamp(1.4rem, 1rem + 1.6vw, 2rem);
  background:
    radial-gradient(circle at 14% 16%, rgba(183, 103, 63, 0.14), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(29, 111, 151, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.84));
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 1rem;
}

.hero::before,
.post-header::before {
  content: "";
  position: absolute;
  right: -4.5rem;
  top: -4.5rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background:
    conic-gradient(
      from 120deg,
      rgba(29, 111, 151, 0.18),
      rgba(183, 103, 63, 0.16),
      rgba(214, 191, 149, 0.04),
      rgba(29, 111, 151, 0.18)
    );
  filter: blur(4px);
  opacity: 0.82;
  animation: drift 16s ease-in-out infinite alternate;
}

.hero::after,
.post-header::after {
  content: "";
  position: absolute;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 1.6rem);
  width: 13rem;
  height: 13rem;
  border-radius: 50%;
  border: 1px dashed rgba(29, 111, 151, 0.24);
  box-shadow:
    inset 0 0 0 16px rgba(255, 255, 255, 0.44),
    inset 0 0 0 48px rgba(214, 191, 149, 0.1);
  opacity: 0.72;
}

.eyebrow,
.section-tag,
.article-kicker,
.post-kicker {
  margin: 0;
  color: var(--copper);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
.blog-title {
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.12;
}

h1,
h2,
h3,
p,
ul {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.48rem;
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  max-width: 10ch;
}

.hero-subtitle {
  margin: 0 0 0.72rem;
  color: var(--blue);
  font-size: 1.06rem;
  font-weight: 700;
}

.hero-copy {
  display: grid;
  align-content: start;
  gap: 0.86rem;
}

.absurd-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.58rem;
  margin: 0 0 0.1rem;
}

.ribbon-item {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.42rem 0.82rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 38, 45, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(250, 247, 242, 0.78));
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 18px rgba(16, 34, 43, 0.06);
}

.hero-copy p,
.article-card p,
.theme-card p,
.contact-panel p,
.post-section p,
.post-section li,
.repo-panel p,
.related-card p {
  color: var(--muted);
}

.hero-note {
  display: grid;
  gap: 0.72rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(29, 111, 151, 0.14);
  background:
    radial-gradient(circle at 84% 18%, rgba(29, 111, 151, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.84));
}

.hero-note::before {
  content: "";
  position: absolute;
  inset: auto 1rem -2rem auto;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(183, 103, 63, 0.18), transparent 66%);
  opacity: 0.7;
}

.hero-note h2,
.section-head h2,
.article-card h2,
.post-header h1,
.post-section h2,
.repo-panel h2,
.contact-panel h2 {
  margin: 0;
}

.hero-note ul,
.contact-panel ul,
.post-section ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.42rem;
}

.section-head {
  display: grid;
  gap: 0.34rem;
}

.section-head h2 {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
  max-width: 24ch;
}

.article-grid,
.theme-grid,
.related-grid {
  display: grid;
  gap: 0.92rem;
}

.article-grid,
.theme-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.related-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.article-card,
.theme-card,
.contact-panel,
.post-section,
.repo-panel,
.related-card {
  padding: 1.05rem 1.08rem;
}

.article-card {
  display: grid;
  gap: 0.68rem;
  background:
    radial-gradient(circle at 90% 18%, rgba(29, 111, 151, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.84));
}

.article-card,
.theme-card,
.contact-panel,
.repo-panel,
.related-card {
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.article-card::before,
.theme-card::before,
.contact-panel::before,
.repo-panel::before,
.related-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, rgba(29, 111, 151, 0.88), rgba(183, 103, 63, 0.55), transparent 70%);
}

.article-card:hover,
.theme-card:hover,
.contact-panel:hover,
.repo-panel:hover,
.related-card:hover {
  transform: translateY(-4px);
  border-color: rgba(29, 111, 151, 0.24);
  box-shadow: 0 24px 52px rgba(16, 34, 43, 0.14);
}

.article-card h2 {
  font-size: 1.34rem;
}

.article-card p {
  margin-bottom: 0;
}

.contact-panel {
  display: grid;
  gap: 0.8rem;
  background:
    radial-gradient(circle at 14% 18%, rgba(183, 103, 63, 0.14), transparent 28%),
    radial-gradient(circle at 86% 80%, rgba(29, 111, 151, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.84));
}

.theme-card:nth-child(2),
.article-card:nth-child(2) {
  background:
    radial-gradient(circle at 12% 18%, rgba(183, 103, 63, 0.1), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(251, 248, 243, 0.86));
}

.breadcrumb {
  display: inline-flex;
  gap: 0.46rem;
  align-items: center;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.post-header {
  padding: clamp(1.35rem, 1rem + 1.6vw, 2rem);
  display: grid;
  gap: 0.84rem;
  background:
    radial-gradient(circle at 14% 16%, rgba(183, 103, 63, 0.14), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(29, 111, 151, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.84));
}

.post-header h1 {
  max-width: 16ch;
  margin-bottom: 0;
}

.post-subtitle {
  margin: 0;
  color: var(--blue);
  font-size: 1.08rem;
  font-weight: 700;
}

.post-lead {
  margin: 0;
  max-width: 72ch;
  color: var(--ink);
  font-size: 1.08rem;
}

.post-section {
  display: grid;
  gap: 0.74rem;
}

.post-section h2 {
  font-size: 1.34rem;
}

.post-section blockquote {
  margin: 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid rgba(29, 111, 151, 0.48);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.45;
}

.post-section blockquote::before {
  content: "“";
  position: absolute;
  right: 0.8rem;
  top: -1.5rem;
  color: rgba(29, 111, 151, 0.12);
  font-family: "Fraunces", Georgia, serif;
  font-size: 7rem;
  line-height: 1;
}

.post-section blockquote .lang-en,
.post-section blockquote .lang-zh {
  display: block;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.82rem;
}

.mini-note {
  padding: 0.82rem 0.86rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mini-note strong {
  display: block;
  margin-bottom: 0.24rem;
  color: var(--ink);
}

.mini-note p {
  margin-bottom: 0;
}

.repo-panel {
  background:
    radial-gradient(circle at 88% 20%, rgba(29, 111, 151, 0.12), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.84));
}

.repo-panel code {
  display: block;
  padding: 0.76rem 0.84rem;
  border-radius: 14px;
  background: rgba(29, 38, 45, 0.92);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
  overflow-x: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.article-actions {
  margin-top: 0.3rem;
}

.blog-footer {
  margin: 0 auto 2rem;
  padding: 1rem 0 0.4rem;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .article-grid,
  .theme-grid,
  .note-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .hero::after,
  .post-header::after {
    display: none;
  }
}

@media (max-width: 980px) {
  .blog-topbar {
    top: 0.6rem;
    padding: 0.72rem 0.76rem;
  }

  .blog-title {
    width: 100%;
    order: -1;
    max-width: none;
  }

  .blog-nav,
  .blog-topbar-actions {
    width: 100%;
    justify-content: center;
  }

  .blog-nav .blog-link {
    flex: 1 1 calc(50% - 0.5rem);
    text-align: center;
  }

  .blog-topbar-actions .blog-link {
    flex: 1 1 12rem;
    text-align: center;
  }
}

@media (max-width: 760px) {
  .blog-topbar,
  .blog-main,
  .blog-footer {
    width: min(var(--max-width), calc(100% - 1rem));
  }

  .blog-topbar {
    top: 0.5rem;
    padding: 0.58rem 0.62rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    transition: transform 220ms ease, opacity 220ms ease, box-shadow 220ms ease;
    will-change: transform, opacity;
  }

  .blog-title {
    width: auto;
    order: 0;
    font-size: 0.96rem;
    padding: 0;
    text-align: left;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    justify-self: end;
  }

  .blog-topbar-menu {
    display: none;
    grid-column: 1 / -1;
    gap: 0.34rem;
  }

  .blog-topbar.is-menu-open .blog-topbar-menu {
    display: grid;
  }

  .blog-nav,
  .blog-topbar-actions {
    width: 100%;
    padding: 0.22rem;
    border-radius: 16px;
  }

  .blog-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    justify-content: stretch;
  }

  .blog-nav .blog-link {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 0.44rem 0.42rem;
    text-align: center;
    line-height: 1.08;
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: anywhere;
    border-radius: 13px;
    font-size: 0.76rem;
  }

  .blog-topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.34rem;
    align-items: center;
  }

  .lang-switch {
    width: auto;
    justify-self: end;
    padding: 0.18rem;
    border-radius: 16px;
  }

  .lang-btn {
    min-width: 2.85rem;
    min-height: 40px;
    padding: 0.34rem 0.48rem;
    font-size: 0.76rem;
  }

  .blog-topbar-actions .blog-link {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    border-radius: 13px;
    font-size: 0.78rem;
  }

  .article-card-actions,
  .footer-actions,
  .article-actions {
    display: flex;
  }

  .article-link,
  .footer-link {
    width: 100%;
  }

  .post-header h1,
  h1 {
    max-width: none;
  }

  .absurd-ribbon {
    gap: 0.42rem;
  }

  .ribbon-item {
    width: 100%;
    justify-content: center;
  }

  body.mobile-nav-hidden .blog-topbar {
    transform: translateY(calc(-100% - 1rem));
    opacity: 0.02;
    pointer-events: none;
    box-shadow: none;
  }

  body.mobile-nav-hidden .blog-topbar.is-menu-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 12px 28px rgba(16, 34, 43, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  .hero::before,
  .post-header::before {
    animation: none;
  }

  .blog-link,
  .lang-btn,
  .meta-pill,
  .article-link,
  .footer-link,
  .article-card,
  .theme-card,
  .contact-panel,
  .repo-panel,
  .related-card {
    transition: none;
  }
}
