/* ============================================================
   Narrative Illustrated — Twilight Garden
   Headings: Playfair Display · Body: Geist
   written by Fred Xiao
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Twilight Garden palette */
  --color-cream:       #faf7f2;
  --color-warm-white:  #f5f0e8;
  --color-sand:        #e8dccf;
  --color-clay:        #c4a88b;
  --color-terracotta:  #b8785a;
  --color-burnt-umber: #8b5e3c;
  --color-moss:        #7a8b6e;
  --color-sage:        #9aab8e;
  --color-olive:       #5a6348;
  --color-dusk:        #4a3f3a;
  --color-night:       #2c2420;
  --color-bark:        #1a1512;

  --color-bg:          var(--color-cream);
  --color-bg-alt:      var(--color-warm-white);
  --color-surface:     #ffffff;
  --color-text:        var(--color-night);
  --color-text-muted:  var(--color-dusk);
  --color-text-soft:   var(--color-clay);
  --color-border:      rgba(180, 150, 130, 0.3);
  --color-border-strong: rgba(180, 150, 130, 0.5);
  --color-accent:      var(--color-terracotta);
  --color-accent-hover: #a05e3f;
  --color-accent-soft: rgba(184, 120, 90, 0.1);
  --color-sage-soft:   rgba(122, 139, 110, 0.08);
  --color-error:       #c55540;
  --color-success:     #6a8b5e;

  /* Sub-page aliases — widely used across blog / docs / tools / games */
  --color-cocoa:       var(--color-night);
  --color-tangerine:   var(--color-terracotta);
  --color-text-softer: var(--color-clay);
  --font-caption:      var(--font-body);

  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-2xl:  48px;
  --space-3xl:  64px;
  --space-4xl:  96px;
  --space-5xl:  128px;

  /* Soft Cloud elevation */
  --shadow-xs:  0 1px 3px  rgba(44, 36, 32, 0.04);
  --shadow-sm:  0 2px 8px  rgba(44, 36, 32, 0.06);
  --shadow-md:  0 4px 16px rgba(44, 36, 32, 0.07);
  --shadow-lg:  0 8px 32px rgba(44, 36, 32, 0.09);
  --shadow-xl:  0 16px 48px rgba(44, 36, 32, 0.11);

  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:  180ms;
  --duration-base:  350ms;
  --duration-slow:  600ms;

  --font-heading:  'Georgia', 'Times New Roman', 'STSong', 'Noto Serif CJK SC', serif;
  --font-body:     -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-cjk:      'STSong', 'Noto Serif CJK SC', 'PingFang SC', 'Microsoft YaHei', serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ============================================================
   BACKGROUND LAYER — Painterly Scene
   ============================================================ */

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* 暖色黄昏渐变遮罩 */
.bg-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    160deg,
    rgba(245, 240, 232, 0.35) 0%,
    rgba(232, 220, 207, 0.45) 30%,
    rgba(200, 180, 155, 0.5) 60%,
    rgba(90, 80, 65, 0.55) 100%
  );
}

/* Painterly illustration decorations */
.bg-illustration {
  position: absolute;
  z-index: 2;
  opacity: 0.5;
}
.bg-illustration--tl {
  top: -20px;
  left: -20px;
  width: 260px;
  height: 260px;
}
.bg-illustration--br {
  bottom: -40px;
  right: -30px;
  width: 280px;
  height: 280px;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 242, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--color-night);
  transition: color var(--duration-fast);
}
.nav__logo:hover {
  color: var(--color-terracotta);
}
.nav__logo-mark {
  color: var(--color-terracotta);
  font-size: 0.9rem;
  transition: transform var(--duration-base) var(--ease-spring);
}
.nav__logo:hover .nav__logo-mark {
  transform: rotate(20deg);
}

.nav__links {
  display: flex;
  gap: var(--space-xl);
  align-items: center;
}

.nav__link {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--duration-fast);
  padding: 4px 0;
  position: relative;
}
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-terracotta);
  border-radius: 1px;
  transition: width var(--duration-base) var(--ease-out);
}
.nav__link:hover {
  color: var(--color-terracotta);
}
.nav__link:hover::after {
  width: 100%;
}

/* Connection status dot */
.nav__status {
  display: flex;
  align-items: center;
  margin-left: var(--space-sm);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-soft);
  box-shadow: 0 0 4px rgba(180, 150, 130, 0.3);
  transition: all var(--duration-base);
}
.status-dot.connected {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(106, 139, 94, 0.4);
}
.status-dot.disconnected {
  background: var(--color-error);
  box-shadow: 0 0 6px rgba(197, 85, 64, 0.4);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  z-index: 1;
  padding: var(--space-5xl) var(--space-lg) var(--space-4xl);
  text-align: center;
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
}

/* Ornament ring */
.hero__ornament {
  color: var(--color-terracotta);
  margin: 0 auto var(--space-xl);
  display: flex;
  justify-content: center;
  animation: ornament-float 4s ease-in-out infinite;
}
@keyframes ornament-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%  { transform: translateY(-4px) rotate(2deg); }
  66%  { transform: translateY(2px) rotate(-2deg); }
}

.hero__kicker {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-text-soft);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.03em;
}

.hero__title {
  margin-bottom: var(--space-xl);
}
.hero__title-line {
  display: block;
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
}
.hero__title-name {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 8vw, 5.5rem);
  font-weight: 700;
  color: var(--color-night);
  letter-spacing: -0.02em;
  line-height: 1.15;
  /* Subtle gradient tint */
  background: linear-gradient(135deg, var(--color-burnt-umber) 0%, var(--color-night) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.9;
  margin-bottom: var(--space-2xl);
}

/* ============================================================
   BUTTONS — Warm · Rounded · Elegant
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 14px 36px;
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.btn--primary {
  background: var(--color-terracotta);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  color: var(--color-burnt-umber);
  border: 1.5px solid var(--color-border-strong);
}
.btn--secondary:hover {
  border-color: var(--color-terracotta);
  color: var(--color-terracotta);
  background: var(--color-accent-soft);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn__arrow {
  font-size: 0.85rem;
  transition: transform var(--duration-base) var(--ease-spring);
}
.btn:hover .btn__arrow {
  transform: translateX(3px);
}

.hero__actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}
.section-header__overline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--color-text-soft);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.05em;
}
.section-header__title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  color: var(--color-night);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
}
.section-header__sub {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-weight: 400;
}
.section-header__divider {
  margin-top: var(--space-lg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.section-header__divider::before,
.section-header__divider::after {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--color-border);
}
.section-header__divider-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-terracotta);
  margin: 0 12px;
}

/* ============================================================
   LOADER
   ============================================================ */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
}
.loader__ring {
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-terracotta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader__text {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-soft);
  letter-spacing: 0.06em;
  animation: loader-text-pulse 1.8s ease-in-out infinite;
}
@keyframes loader-text-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============================================================
   BLOG SECTION
   ============================================================ */
.blog {
  position: relative;
  z-index: 1;
  padding: var(--space-4xl) var(--space-lg);
}

.blog__inner {
  max-width: 960px;
  margin: 0 auto;
}

.blog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.blog__error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  border: 1px solid rgba(197, 85, 64, 0.25);
  border-radius: var(--radius-md);
  background: rgba(197, 85, 64, 0.04);
  color: var(--color-error);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
}

/* More section error — same visual as blog error */
.more__error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  border: 1px solid rgba(197, 85, 64, 0.25);
  border-radius: var(--radius-md);
  background: rgba(197, 85, 64, 0.04);
  color: var(--color-error);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
}

/* Blog card — soft cloud elevation */
.blog-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.blog-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-terracotta), transparent);
  opacity: 0;
  transition: opacity var(--duration-base);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--color-border-strong);
}
.blog-card:hover::before {
  opacity: 0.7;
}

.blog-card__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-night);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.blog-card__meta {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-soft);
  margin-bottom: var(--space-sm);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.blog-card__desc {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ============================================================
   MORE SECTION
   ============================================================ */
.more {
  position: relative;
  z-index: 1;
  padding: var(--space-3xl) var(--space-lg) var(--space-5xl);
}

.more__inner {
  max-width: 800px;
  margin: 0 auto;
}

.more__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

/* More card — soft pill badge */
.more-card {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--duration-base) var(--ease-out);
}
.more-card:hover {
  border-color: var(--color-clay);
  color: var(--color-night);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.more-card__title {
  font-weight: 500;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  padding: var(--space-3xl) var(--space-lg) var(--space-2xl);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.footer__logo {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--color-night);
}

.footer__tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.footer__social {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  transition: all var(--duration-fast);
}
.footer__social-link:hover {
  color: var(--color-terracotta);
  border-color: var(--color-terracotta);
  background: var(--color-accent-soft);
}

.footer__copy {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-text-soft);
}
.footer__copy a {
  color: var(--color-text-soft);
  text-decoration: none;
  transition: opacity var(--duration-fast);
}
.footer__copy a:hover { opacity: 0.65; }

.footer--minimal {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   CONTENT VIEW (shared wrapper for blog sub-pages)
   ============================================================ */
.content-view {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-lg) var(--space-4xl);
}

.content-view__header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.content-view__breadcrumb {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}
.content-view__breadcrumb a {
  color: var(--color-tangerine);
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--duration-fast);
}
.content-view__breadcrumb a:hover { opacity: 0.7; text-decoration: underline; }
.content-view__breadcrumb .sep {
  opacity: 0.4;
  margin: 0 var(--space-xs);
}

.content-view h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: var(--color-cocoa);
  margin-bottom: var(--space-sm);
}

.content-view__desc {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto;
}

.content-view__tip {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-cream);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  display: inline-block;
}
.content-view__tip code {
  background: var(--color-tangerine);
  color: #FFF;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.78rem;
}

/* ============================================================
   POST LIST & POST CARD (md-reader.js)
   ============================================================ */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.post-list__empty {
  text-align: center;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: var(--space-2xl) var(--space-lg);
}

.post-list__empty code {
  background: var(--color-tangerine);
  color: #FFF;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.78rem;
}

.post-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-tangerine);
  transform: translateY(-2px);
}

.post-card__body {
  flex: 1;
  min-width: 0;
}

.post-card__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-cocoa);
  margin-bottom: 2px;
  line-height: 1.35;
}

.post-card__date {
  font-family: var(--font-caption);
  font-size: 0.75rem;
  color: var(--color-text-softer);
}

.post-card__desc {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.post-card__arrow {
  font-size: 1.1rem;
  color: var(--color-text-softer);
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-spring);
}
.post-card:hover .post-card__arrow {
  transform: translateX(3px);
  color: var(--color-tangerine);
}

/* ============================================================
   MARKDOWN READER
   ============================================================ */
.md-reader__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-tangerine);
  font-family: var(--font-caption);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  margin-bottom: var(--space-lg);
}
.md-reader__back:hover {
  background: var(--color-accent-soft);
  border-color: var(--color-tangerine);
}
.md-reader__back--bottom {
  margin-top: var(--space-2xl);
  margin-bottom: 0;
}

.md-reader__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--color-cocoa);
  margin-bottom: var(--space-lg);
  line-height: 1.3;
}

.md-reader__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-family: var(--font-caption);
  font-size: 0.88rem;
}

.md-reader__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-tangerine);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.md-reader__error {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: rgba(197, 85, 64, 0.06);
  border: 1px solid rgba(197, 85, 64, 0.25);
  color: var(--color-error);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: var(--space-lg);
}

.md-reader__body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--color-text);
}

.md-reader__body h1,
.md-reader__body h2,
.md-reader__body h3,
.md-reader__body h4 {
  font-family: var(--font-heading);
  color: var(--color-cocoa);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  line-height: 1.3;
}

.md-reader__body h1 { font-size: 1.8rem; }
.md-reader__body h2 { font-size: 1.45rem; border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-xs); }
.md-reader__body h3 { font-size: 1.2rem; }

.md-reader__body p {
  margin-bottom: var(--space-md);
}

.md-reader__body ul, .md-reader__body ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

.md-reader__body li {
  margin-bottom: var(--space-xs);
}

.md-reader__body ul li {
  list-style-type: disc;
}

.md-reader__body ol li {
  list-style-type: decimal;
}

.md-reader__body code {
  background: var(--color-cream);
  color: var(--color-tangerine);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

.md-reader__body pre {
  background: #1e1a17;
  color: #f0e6da;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
  line-height: 1.6;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.md-reader__body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.md-reader__body blockquote {
  border-left: 3px solid var(--color-terracotta);
  padding: var(--space-sm) var(--space-lg);
  margin: var(--space-lg) 0;
  background: var(--color-accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-dusk);
  font-style: italic;
}

.md-reader__body a {
  color: var(--color-tangerine);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity var(--duration-fast);
}
.md-reader__body a:hover {
  opacity: 0.7;
}

.md-reader__body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
}

.md-reader__body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
}
.md-reader__body th,
.md-reader__body td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  text-align: left;
}
.md-reader__body th {
  background: var(--color-cream);
  font-weight: 600;
  color: var(--color-cocoa);
}

.md-reader__body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  right: var(--space-xl);
  bottom: var(--space-xl);
  z-index: 1000;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-terracotta);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--duration-base) var(--ease-out);
  font-family: var(--font-body);
  font-size: 1.2rem;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--color-terracotta);
  box-shadow: var(--shadow-lg);
  background: var(--color-accent-soft);
  transform: translateY(-2px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav__links {
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .nav__link {
    font-size: 0.8rem;
  }

  .hero {
    padding: var(--space-4xl) var(--space-md) var(--space-3xl);
    min-height: 60vh;
  }
  .hero__title-name {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }

  .blog__grid {
    grid-template-columns: 1fr;
  }

  .bg-illustration {
    display: none;
  }
}

@media (max-width: 480px) {
  .nav__inner {
    padding: 0 var(--space-md);
  }
  .nav__links {
    gap: 10px;
  }
  .nav__link {
    font-size: 0.72rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .section-header__title {
    font-size: 1.6rem;
  }

  .more__grid {
    gap: var(--space-sm);
  }
  .more-card {
    padding: 8px 18px;
    font-size: 0.82rem;
  }

  .back-to-top {
    right: var(--space-md);
    bottom: var(--space-md);
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* ============================================================
   Anime Sky Dark Skin — shared by legacy sub-pages
   Keeps old page markup and reader behavior, only changes visual style.
   ============================================================ */
:root {
  --color-cream: rgba(255, 255, 255, 0.08);
  --color-warm-white: rgba(255, 255, 255, 0.1);
  --color-sand: rgba(255, 255, 255, 0.16);
  --color-clay: #8fb7ff;
  --color-terracotta: #8fd6ff;
  --color-burnt-umber: #a7ffe5;
  --color-moss: #9bc8ff;
  --color-sage: #b3d7ff;
  --color-olive: #a7ffe5;
  --color-dusk: #b8c7d8;
  --color-night: #f3f8ff;
  --color-bark: #f7fbff;
  --color-bg: #07111f;
  --color-bg-alt: rgba(7, 15, 28, 0.72);
  --color-surface: rgba(7, 15, 28, 0.62);
  --color-text: #f3f8ff;
  --color-text-muted: #b3c4d4;
  --color-text-soft: #8ca3b7;
  --color-border: rgba(255, 255, 255, 0.18);
  --color-border-strong: rgba(143, 214, 255, 0.42);
  --color-accent: #8fd6ff;
  --color-accent-hover: #b9e7ff;
  --color-accent-soft: rgba(143, 214, 255, 0.12);
  --color-sage-soft: rgba(167, 255, 229, 0.1);
  --color-cocoa: #f3f8ff;
  --color-tangerine: #8fd6ff;
  --color-text-softer: #8ca3b7;
  --shadow-sm: 0 12px 34px rgba(0, 10, 24, 0.24);
  --shadow-md: 0 18px 60px rgba(0, 10, 24, 0.3);
  --shadow-lg: 0 26px 80px rgba(0, 10, 24, 0.38);
  --shadow-xl: 0 34px 110px rgba(0, 10, 24, 0.46);
  --font-heading: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
  position: relative;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(2, 6, 14, 0.32), rgba(2, 7, 16, 0.58) 58%, rgba(1, 4, 10, 0.9)),
    url("/assets/anime-sky-bg.png") center top / cover fixed,
    #07111f;
  color: var(--color-text);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(143, 214, 255, 0.14), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 220, 160, 0.08), transparent 30%);
  background-size: 56px 56px, 56px 56px, auto, auto;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 10%, transparent 0 30%, rgba(2, 7, 15, 0.24) 72%),
    linear-gradient(180deg, rgba(3, 8, 16, 0.12), rgba(1, 3, 8, 0.74));
}

.bg-layer,
.bg-illustration {
  display: none;
}

.nav {
  top: 16px;
  width: min(1180px, calc(100% - 40px));
  margin: 16px auto 0;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(7, 15, 28, 0.58);
  box-shadow: 0 18px 50px rgba(0, 10, 24, 0.28);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.nav__inner {
  height: 58px;
}

.nav__logo,
.nav__logo-mark,
.nav__link,
.footer__logo {
  color: var(--color-text);
}

.nav__link:hover,
.nav__logo:hover,
.nav__logo:hover .nav__logo-mark {
  color: var(--color-accent);
}

.blog-hub,
.docs-hub,
.cs-hub,
.mcu-page,
.placeholder-page,
.sub-page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  padding-top: var(--space-3xl);
}

.blog-hub__header,
.docs-hub__header,
.cs-hub__header,
.mcu-page__header {
  margin-bottom: var(--space-2xl);
}

.blog-hub__title,
.docs-hub__title,
.cs-hub__title,
.mcu-page__title,
.placeholder-page__title,
.sub-page h1 {
  color: var(--color-text);
  font-size: clamp(2.3rem, 6vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.blog-hub__desc,
.docs-hub__desc,
.cs-hub__desc,
.mcu-page__desc,
.placeholder-page__desc,
.sub-page p {
  color: var(--color-text-muted);
}

.blog-hub__grid,
.docs-hub__grid,
.cs-hub__grid {
  gap: 14px;
}

.cat-card,
.docs-card,
.cs-card,
.inline-docs,
.inline-posts,
.content-view,
.more-card,
.blog-card,
.link-card,
.sub-page,
.placeholder-page {
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.2), transparent 48%),
    rgba(7, 15, 28, 0.62);
  box-shadow: 0 18px 60px rgba(0, 10, 24, 0.26);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.cat-card:hover,
.docs-card:hover,
.cs-card:hover,
.blog-card:hover,
.more-card:hover,
.link-card:hover {
  border-color: rgba(143, 214, 255, 0.52);
  box-shadow: 0 22px 74px rgba(0, 10, 24, 0.38);
}

.cat-card__title,
.docs-card__title,
.cs-card__title,
.link-card__title,
.blog-card__title,
.more-card__title,
.inline-docs__title,
.inline-posts__title,
.md-reader__title {
  color: var(--color-text);
}

.cat-card__desc,
.docs-card__desc,
.cs-card__desc,
.link-card__desc,
.blog-card__desc,
.md-reader__body,
.footer__copy {
  color: var(--color-text-muted);
}

.cat-card__tag,
.docs-card__tag,
.cs-card__tag,
.placeholder-page__badge,
.back-link {
  border: 1px solid rgba(143, 214, 255, 0.35);
  background: rgba(143, 214, 255, 0.12);
  color: var(--color-accent);
}

.md-reader__body {
  background: transparent;
}

.md-reader__body h1,
.md-reader__body h2,
.md-reader__body h3,
.md-reader__body strong {
  color: var(--color-text);
}

.md-reader__body pre,
.md-reader__body code {
  border-color: var(--color-border);
  background: rgba(2, 7, 15, 0.58);
  color: #dff7ff;
}

.footer--minimal,
.footer {
  position: relative;
  z-index: 1;
  border-top-color: var(--color-border);
  color: var(--color-text-muted);
}

@media (max-width: 700px) {
  .nav {
    width: min(100% - 24px, 1180px);
    border-radius: 24px;
  }

  .nav__inner {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .nav__links {
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
  }
}

/* ============================================================
   Coordination Patch — align legacy pages with the new homepage
   ============================================================ */
body {
  background-color: #07111f;
}

.blog-hub,
.docs-hub,
.cs-hub,
.mcu-page,
.placeholder-page,
.sub-page {
  width: min(1180px, calc(100% - 40px));
  min-height: auto;
  margin: 0 auto;
  padding: clamp(54px, 8vw, 92px) 0 clamp(52px, 7vw, 84px);
}

.blog-hub__header,
.docs-hub__header,
.cs-hub__header,
.mcu-page__header {
  max-width: 780px;
  margin: 0 auto clamp(28px, 4vw, 46px);
  text-align: left;
}

.blog-hub__breadcrumb,
.docs-hub__breadcrumb,
.cs-hub__breadcrumb,
.mcu-page__breadcrumb,
.placeholder-page__breadcrumb,
.essay-page__breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: #9fc6e8;
  font-size: 0.9rem;
}

.blog-hub__breadcrumb a,
.docs-hub__breadcrumb a,
.cs-hub__breadcrumb a,
.mcu-page__breadcrumb a,
.placeholder-page__breadcrumb a,
.essay-page__breadcrumb a {
  color: #8fd6ff;
}

.blog-hub__title,
.docs-hub__title,
.cs-hub__title,
.mcu-page__title,
.placeholder-page__title,
.sub-page h1 {
  max-width: 780px;
  margin: 0 0 14px;
  font-size: clamp(42px, 7vw, 86px);
  font-weight: 900;
  line-height: 0.94;
  text-align: left;
  text-shadow: 0 20px 70px rgba(0, 10, 24, 0.36);
}

.blog-hub__desc,
.docs-hub__desc,
.cs-hub__desc,
.mcu-page__desc,
.placeholder-page__desc,
.sub-page p {
  max-width: 720px;
  margin: 0;
  color: #c4d4e4;
  font-size: clamp(16px, 2vw, 20px);
  text-align: left;
}

.blog-hub__grid,
.docs-hub__grid,
.cs-hub__grid {
  width: 100%;
  max-width: none;
}

#post-list-section,
#post-list-container,
.inline-posts,
.inline-docs,
.content-view {
  width: min(900px, 100%);
  margin-right: auto;
  margin-left: auto;
}

#post-list-section {
  margin-top: 30px;
}

.post-list,
.md-reader__list {
  display: grid;
  gap: 14px;
}

.post-card,
.md-reader__post,
.post-item,
.link-card,
.essay-card {
  border-radius: 18px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.12), transparent 46%),
    rgba(7, 15, 28, 0.68);
}

.mcu-page #post-list-container > * {
  border-color: rgba(255, 255, 255, 0.18);
}

.mcu-page a,
.cs-hub a,
.docs-hub a,
.blog-hub a {
  text-decoration: none;
}

.footer--minimal {
  width: min(1180px, calc(100% - 40px));
  margin: 20px auto 0;
  padding: 26px 0 34px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent !important;
  text-align: center;
}

.footer--minimal .footer__copy,
.footer--minimal a {
  color: rgba(196, 212, 228, 0.78);
}

.md-reader__back {
  border: 1px solid rgba(143, 214, 255, 0.3);
  background: rgba(143, 214, 255, 0.12);
  color: #dff4ff;
}

.md-reader__body {
  color: #d8e6f3;
  font-size: 1rem;
}

.md-reader__body p {
  color: #d8e6f3;
}

@media (max-width: 700px) {
  .blog-hub,
  .docs-hub,
  .cs-hub,
  .mcu-page,
  .placeholder-page,
  .sub-page {
    width: min(100% - 24px, 1180px);
    padding-top: 42px;
  }
}

/* Must outrank legacy inline page styles. */
body .blog-hub,
body .docs-hub,
body .cs-hub,
body .mcu-page,
body .placeholder-page,
body .sub-page {
  width: min(1180px, calc(100% - 40px)) !important;
  max-width: 1180px !important;
  padding: clamp(54px, 8vw, 92px) 0 clamp(52px, 7vw, 84px) !important;
}

body .blog-hub__header,
body .docs-hub__header,
body .cs-hub__header,
body .mcu-page__header {
  max-width: 780px !important;
  margin-right: auto !important;
  margin-left: auto !important;
  margin-bottom: clamp(28px, 4vw, 46px) !important;
  text-align: left !important;
}

body .blog-hub__title,
body .docs-hub__title,
body .cs-hub__title,
body .mcu-page__title,
body .placeholder-page__title,
body .sub-page h1 {
  color: #f3f8ff !important;
  font-family: var(--font-heading) !important;
  font-size: clamp(42px, 7vw, 86px) !important;
  font-weight: 900 !important;
  line-height: 0.94 !important;
  text-align: left !important;
}

body .blog-hub__desc,
body .docs-hub__desc,
body .cs-hub__desc,
body .mcu-page__desc,
body .placeholder-page__desc,
body .sub-page p {
  max-width: 720px !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  color: #c4d4e4 !important;
  text-align: left !important;
}

body #post-list-section {
  width: min(900px, 100%) !important;
  margin: 28px auto 0 !important;
}

body .footer--minimal {
  width: min(1180px, calc(100% - 40px)) !important;
  margin: 20px auto 0 !important;
  padding: 26px 0 34px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
  background: transparent !important;
}

/* Shared rounded navigation for legacy sub-pages. */
.legacy-shell-nav {
  position: sticky;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1180px, calc(100% - 40px));
  min-height: 62px;
  margin: 16px auto 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(7, 15, 28, 0.62);
  box-shadow: 0 18px 50px rgba(0, 10, 24, 0.28);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.legacy-shell-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.legacy-shell-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(143, 214, 255, 0.82));
  color: #10233a;
  font-size: 13px;
  font-weight: 900;
}

.legacy-shell-brand span:last-child {
  display: grid;
  line-height: 1.1;
}

.legacy-shell-brand strong {
  color: #f3f8ff;
  font-size: 14px;
}

.legacy-shell-brand small {
  color: #b3c4d4;
  font-size: 11px;
  text-transform: uppercase;
}

.legacy-shell-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.legacy-shell-links a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: #c4d4e4;
  font-size: 13px;
  font-weight: 650;
}

.legacy-shell-links a:hover {
  background: rgba(143, 214, 255, 0.13);
  color: #f3f8ff;
}

body .blog-hub,
body .docs-hub,
body .cs-hub,
body .mcu-page,
body .placeholder-page,
body .sub-page {
  padding-top: clamp(42px, 6vw, 72px) !important;
}

@media (max-width: 760px) {
  .legacy-shell-nav {
    width: min(100% - 24px, 1180px);
    align-items: flex-start;
    border-radius: 24px;
  }

  .legacy-shell-links {
    display: none;
  }
}

/* Background brightness adjustment — 2026-06-02 */
body {
  background:
    linear-gradient(180deg, rgba(2, 6, 14, 0.22), rgba(2, 7, 16, 0.44) 58%, rgba(1, 4, 10, 0.78)),
    url("/assets/anime-sky-bg.png") center top / cover fixed,
    #07111f;
}

body::after {
  background:
    radial-gradient(circle at 50% 10%, transparent 0 32%, rgba(2, 7, 15, 0.16) 72%),
    linear-gradient(180deg, rgba(3, 8, 16, 0.08), rgba(1, 3, 8, 0.62));
}
