:root {
  /* -- Design Tokens -- */
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --brand-primary: #f7a41d;
  --brand-primary-hover: #e69512;
  --brand-accent: #f7a41d;
  --brand-blue: #0284c7;
  
  --link: #d97706;
  --link-hover: #b45309;
  
  --code-bg: #f8fafc;
  --code-text: #0f172a;
  
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
  --shadow-glow: 0 0 25px -5px rgba(247, 164, 29, 0.25);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  
  --spacing-unit: 8px;
  --container-width: 900px;
  --home-max-width: 1040px;
  --header-height: 68px;
  --page-padding: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0d13;
    --bg-secondary: #121720;
    --bg-card: rgba(18, 23, 32, 0.75);
    --bg-card-hover: rgba(28, 35, 48, 0.85);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-subtle: #1e293b;
    --border-strong: #334155;
    
    --brand-primary: #f7a41d;
    --brand-primary-hover: #ffb83d;
    --brand-accent: #f7a41d;
    --brand-blue: #38bdf8;
    
    --link: #fbbf24;
    --link-hover: #fde68a;
    
    --code-bg: #111722;
    --code-text: #f1f5f9;
    
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.5);
    --shadow-glow: 0 0 35px -5px rgba(247, 164, 29, 0.35);
  }
}

/* -- Reset & Base -- */

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-wrap: break-word;
}

/* -- Typography -- */

h1, h2, h3, h4, h5, h6 {
  margin-top: 2em;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  color: inherit;
  text-decoration: none;
  transition: none;
}

h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
  color: inherit;
  text-decoration: none;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  overflow-wrap: break-word;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5rem;
}

/* -- Article List (Post/Monthly Index) -- */

.article-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.article-list li {
  margin-bottom: 0.75rem;
}

.article-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  text-decoration: none !important;
  transition: all 0.2s ease;
  min-width: 0;
}

.article-item:hover {
  border-color: var(--brand-primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.article-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.05rem;
  min-width: 0;
}

.article-date {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-left: 1rem;
  white-space: nowrap;
}

.article-item:hover .article-title {
  color: var(--brand-primary);
}

@media screen and (max-width: 600px) {
  .article-item {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .article-date {
    margin-left: 0;
    font-size: 0.8rem;
  }
}

/* -- Monthly Timeline -- */

.monthly-intro {
  margin-bottom: 3rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.monthly-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0;
  margin-top: 2rem;
}

.monthly-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.monthly-item:hover {
  border-bottom-color: var(--brand-primary);
}

.monthly-item:hover .monthly-item-title {
  color: var(--brand-primary);
}

.monthly-item-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 0;
}

.monthly-item-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin-left: 2rem;
  white-space: nowrap;
}

.monthly-date-part {
  font-weight: 600;
  color: var(--text-secondary);
}

.monthly-sep {
  opacity: 0.4;
  color: var(--text-tertiary);
  margin: 0 1px;
}

@media screen and (max-width: 600px) {
  .monthly-item {
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0;
  }
  
  .monthly-item-meta {
    margin-left: 0;
    font-size: 0.85rem;
  }
}

/* -- Learn Landing Page -- */

.learn-chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.learn-item {
  display: flex;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-decoration: none !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
}

.learn-item:hover {
  border-color: var(--brand-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  background: var(--bg-primary);
}

.learn-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-tertiary);
  opacity: 0.2;
  margin-right: 1.25rem;
  line-height: 1;
}

.learn-item:hover .learn-num {
  color: var(--brand-primary);
  opacity: 0.8;
}

.learn-info {
  display: flex;
  flex-direction: column;
}

.learn-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.learn-item:hover .learn-title {
  color: var(--brand-primary);
}

.learn-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* -- Components -- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(13, 17, 23, 0.85);
  }
}

.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: var(--text-primary) !important;
  transition: transform 0.2s ease;
}

.site-title:hover {
  transform: translateY(-1px);
}

.site-logo {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.site-title:hover .site-logo {
  transform: rotate(-8deg) scale(1.08);
}

.site-title h1 {
  font-size: 1.25rem;
  margin: 0;
  border: none;
  padding: 0;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.site-title:hover h1 {
  color: var(--brand-accent) !important;
}

nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none !important;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

nav a:hover {
  color: var(--brand-primary);
  background: var(--bg-card-hover);
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  z-index: 50;
  transition: background-color 0.2s;
  margin-right: -0.5rem;
}

.mobile-menu-toggle:hover {
  background: var(--bg-secondary);
}

.mobile-menu-line {
  width: 1.25rem;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s;
}

.mobile-menu-line:not(:last-child) {
  margin-bottom: 0.25rem;
}

.mobile-menu-toggle.active .mobile-menu-line:nth-child(1) {
  transform: rotate(45deg) translate(0.375rem, 0.375rem);
}

.mobile-menu-toggle.active .mobile-menu-line:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.mobile-menu-toggle.active .mobile-menu-line:nth-child(3) {
  transform: rotate(-45deg) translate(0.375rem, -0.375rem);
}

@media screen and (max-width: 600px) {
  .mobile-menu-toggle {
    display: flex;
  }
}

.content-wrapper {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 2rem var(--page-padding);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.search-container {
  margin-top: 4rem;
  width: 100%;
}


#search .pagefind-ui, 
#search .pagefind-ui *,
#search .pagefind-ui *::before,
#search .pagefind-ui *::after {
  box-sizing: border-box; 
}

#search .pagefind-ui .pagefind-ui__search-input {
  background-color: transparent;
  color: var(--text-primary);
  border: none;
  border-bottom: 2px solid var(--border-subtle);
  padding: 12px 0 12px 40px;
  font-size: 2rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 24px 24px;
  border-radius: 0;
}

@media (prefers-color-scheme: dark) {
  #search .pagefind-ui .pagefind-ui__search-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  }
}

#search .pagefind-ui .pagefind-ui__search-input:focus {
  border-bottom-color: var(--brand-primary);
}

/* Hide default Pagefind form icon to prevent duplication */
#search .pagefind-ui .pagefind-ui__form::before {
  display: none;
}

#search .pagefind-ui .pagefind-ui__search-clear {
  display: none;
}

#search .pagefind-ui .pagefind-ui__result {
  list-style: none;
  padding: 0;
  margin: 3rem 0;
  border: none;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 3rem;
}

#search .pagefind-ui .pagefind-ui__result:last-child {
  border-bottom: none;
}

#search .pagefind-ui .pagefind-ui__result-link {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.75rem;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

#search .pagefind-ui .pagefind-ui__result-link:hover {
  color: var(--brand-primary);
  text-decoration: none;
}

#search .pagefind-ui .pagefind-ui__result-excerpt {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.05rem;
  margin-bottom: 0;
}

#search .pagefind-ui .pagefind-ui__result-excerpt mark {
  background-color: transparent;
  color: var(--brand-primary);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

#search .pagefind-ui .pagefind-ui__result-nested {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 0 0.5rem;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--border-subtle);
}

#search .pagefind-ui .pagefind-ui__result-nested .pagefind-ui__result-link::before {
  content: none;
  display: none;
}

#search .pagefind-ui .pagefind-ui__result-nested + .pagefind-ui__result-nested {
  margin-top: 0;
  padding-top: 1rem;
}

#search .pagefind-ui .pagefind-ui__result-sub {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#search .pagefind-ui .pagefind-ui__result-sub::before {
  display: none;
}

#search .pagefind-ui .pagefind-ui__result-sub .pagefind-ui__result-link {
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

#search .pagefind-ui .pagefind-ui__result-sub .pagefind-ui__result-link:hover {
  color: var(--brand-primary);
}

#search .pagefind-ui .pagefind-ui__result-sub .pagefind-ui__result-excerpt {
  font-size: 0.95rem;
  color: var(--text-tertiary);
  opacity: 0.9;
}

#search .pagefind-ui .pagefind-ui__message {
  padding: 2rem 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#search .pagefind-ui .pagefind-ui__button {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  padding: 12px;
  width: 100%;
  cursor: pointer;
  margin-top: 2rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#search .pagefind-ui .pagefind-ui__button:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.main-content {
  width: 100%;
  min-width: 0;
}

.main-content > h1:first-child {
  margin-top: 0;
}

.pagefind-ui__results {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.main-content div > h1:first-child,
.monthly-intro h1:first-child {
  display: none;
}

.toc-sidebar {
  display: none;
}

.toc-sidebar:not(:has(li)),
.toc-fallback:not(:has(li)) {
  display: none !important;
}

.toc-fallback {
  margin: 2rem 0;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.toc-fallback h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.toc-fallback ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-fallback li {
  margin: 0.4rem 0;
}

.toc-fallback a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.toc-fallback a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.toc-fallback ul ul {
  padding-left: 1.5rem;
}

@media screen and (min-width: 1024px) {
  .toc-fallback {
    display: none;
  }
  .container {
    max-width: 1100px;
  }

  .content-wrapper {
    flex-direction: row;
    gap: 3rem;
    max-width: 1100px;
  }
  
  .toc-sidebar {
    display: block;
    width: 240px;
    flex-shrink: 0;
    order: 2;
    font-size: 0.85rem;
  }
  
  .toc-sticky {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    max-height: calc(100vh - var(--header-height) - 4rem);
    overflow-y: auto;
    padding-left: 1rem;
  }
  
  .toc-sticky h3 {
    margin: 0 0 1rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-weight: 600;
  }

  .toc-sticky ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--border-subtle);
  }

  .toc-sticky ul ul {
    margin: 0;
    padding: 0;
    border: none;
  }

  .toc-sticky li {
    margin: 0;
  }

  .toc-sticky a {
    display: block;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    margin-left: -1px; /* Align border with the container border */
  }

  .toc-sticky ul ul a {
    padding-left: 2rem;
    font-size: 0.95em;
  }
  
  .toc-sticky ul ul ul a {
    padding-left: 3rem;
  }

  .toc-sticky a:hover {
    color: var(--brand-primary);
    border-left-color: var(--brand-primary);
    background: var(--bg-secondary);
    text-decoration: none;
  }
  
  .toc-sticky a.active {
    color: var(--brand-primary);
    border-left-color: var(--brand-primary);
    background: var(--bg-secondary);
  }
  
  .toc-sticky::-webkit-scrollbar { width: 4px; }
  .toc-sticky::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--brand-primary);
  background: transparent;
  border-radius: 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.6;
}

blockquote p {
  margin: 0;
}

/* -- AI Notice -- */

.ai-notice:empty {
  display: none;
}

.ai-notice {
  margin: 1.5rem 0;
  padding: 0.875rem 1.25rem;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.95rem;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .ai-notice {
    background: #1c1a0e;
    border-color: #b45309;
    border-left-color: #f59e0b;
    color: #fcd34d;
  }
}

/* -- Code Blocks -- */

.code-block-container {
  position: relative;
  margin: 1.5rem 0;
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}

pre {
  display: flex;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9em;
  line-height: 1.6;
  color: var(--code-text);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

pre::-webkit-scrollbar {
  height: 6px;
}

pre::-webkit-scrollbar-track {
  background: transparent;
}

pre::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.line-numbers {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.5rem;
  border-right: 1px solid var(--border-subtle);
  background: var(--code-bg);
  color: var(--text-tertiary);
  text-align: right;
  user-select: none;
  position: sticky;
  left: 0;
  z-index: 10;
  min-width: 2.5rem;
  font-size: 0.9rem;
}

.line-numbers span {
  display: block;
  height: 1.6em;
}

pre code {
  flex-grow: 1;
  display: block;
  padding: 1rem 0.75rem;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: inherit;
  line-height: 1.6;
  border-radius: 0;
}

:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  background: transparent;
  padding: 0;
  color: var(--code-text);
  border: none;
  display: inline;
  white-space: normal;
  word-break: break-all;
}

.copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: scale(0.95);
}

.code-block-container:hover .copy-code-btn {
  opacity: 1;
  transform: scale(1);
}

.copy-code-btn:hover {
  background: var(--bg-primary);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.copy-code-btn.copied {
  color: #10b981;
  border-color: #10b981;
}

p:has(+ .code-block-container) {
  margin-bottom: 0.75rem;
}

@media screen and (max-width: 600px) {
  .code-block-container {
    margin-left: -24px;
    margin-right: -24px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .copy-code-btn {
    top: 0.75rem;
    right: 0.75rem;
    background: var(--bg-primary);
  }
  
  .line-numbers {
    padding-left: 1rem;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

th, td {
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

tr:nth-child(even) {
  background-color: rgba(0,0,0,0.01);
}

img, video, iframe, embed, object, canvas, svg {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

figcaption {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 0;
}

footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 4rem var(--page-padding) 2rem;
  background: var(--bg-secondary);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-container {
  max-width: var(--home-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  width: 28px;
  height: 28px;
}

.footer-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.footer-tagline {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-col h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col a {
  color: var(--text-tertiary);
  text-decoration: none !important;
  font-size: 0.9rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-col a:hover {
  color: var(--brand-primary);
  transform: translateX(2px);
}

.footer-bottom {
  max-width: var(--home-max-width);
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.footer-bottom a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

footer .social-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

footer .social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

footer .social-links a:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

footer img {
  height: 18px;
  width: auto;
  vertical-align: middle;
  opacity: 0.8;
  transition: opacity 0.2s;
  filter: none; 
}

@media (prefers-color-scheme: dark) {
  footer img {
    filter: invert(1);
  }
}

footer .social-links a:hover img {
  opacity: 1;
}

@media screen and (max-width: 768px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}

/* -- Legacy/Utility Classes -- */

.center {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.5rem 0;
}

.large {
  font-size: 1.5rem;
  line-height: 1.4;
  font-weight: 300;
}

.bold {
  font-weight: 700;
}

#meta {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

#meta p { margin: 0; }

#meta #author::before {
  content: "by ";
  opacity: 0.7;
}

#prev-next {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

#prev-next > div {
  flex: 1;
  min-width: 0;
}

#prev-next a {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: none;
  background: transparent;
  text-decoration: none !important;
}

#prev-next span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.2s ease;
}

#prev-next a:hover span {
  color: var(--brand-primary);
}

#prev-next > :first-child a::before {
  content: "← PREV";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#prev-next > :last-child a {
  text-align: right;
  align-items: flex-end;
}

#prev-next > :last-child a::before {
  content: "NEXT →";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#prev-next > :first-child span::before { content: none; }
#prev-next > :last-child span::after { content: none; }

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

@media screen and (max-width: 600px) {
  :root {
    --page-padding: 20px;
  }

  .header {
    padding: 0;
  }
  
  .content-wrapper {
    padding: 0.75rem var(--page-padding) 1.5rem;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  
  nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    flex-direction: column;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    z-index: 90;
    gap: 0;
  }

  nav.active {
    display: flex;
  }

  nav a {
    width: 100%;
    padding: 1rem 24px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 1rem;
  }

  nav a:last-child {
    border-bottom: none;
  }

  .article-title, .monthly-item-title {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

hr {
  border: none;
  margin: 4rem 0;
  height: 1px;
}

/* ==========================================================================
   Modern Homepage Styles (ZigCC Modern Aesthetic)
   ========================================================================== */

.home-container {
  width: 100%;
  max-width: var(--home-max-width);
  margin: 0 auto;
  padding: 1rem var(--page-padding) 4rem;
  flex: 1;
}

/* -- Hero Section -- */

.hero-section {
  position: relative;
  text-align: center;
  padding: 4.5rem 1rem 3.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translate(-50%, -20%);
  width: 500px;
  height: 300px;
  background: radial-gradient(circle, rgba(247, 164, 29, 0.16) 0%, rgba(247, 164, 29, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .hero-section::before {
    background: radial-gradient(circle, rgba(247, 164, 29, 0.22) 0%, rgba(247, 164, 29, 0) 70%);
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--brand-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(247, 164, 29, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(247, 164, 29, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(247, 164, 29, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(247, 164, 29, 0);
  }
}

.hero-logo-wrap {
  margin-bottom: 1.5rem;
  position: relative;
}

.hero-logo {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 8px 16px rgba(247, 164, 29, 0.25));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-logo:hover {
  transform: scale(1.08) rotate(4deg);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem 0;
  max-width: 820px;
}

.gradient-text {
  background: linear-gradient(135deg, #f7a41d 0%, #ff6b00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-desc {
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 0 2.25rem 0;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* -- Buttons -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #f7a41d 0%, #ea580c 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px 0 rgba(234, 88, 12, 0.35);
  border: 1px solid transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(234, 88, 12, 0.45);
  color: #ffffff !important;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary) !important;
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* -- Section Standard -- */

.home-section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.section-header {
  text-align: center;
  margin-bottom: 2.75rem;
}

.section-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-tertiary);
  margin: 0;
}

/* -- Features Grid -- */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.feature-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.feature-icon-box.orange {
  background: rgba(247, 164, 29, 0.12);
  color: #f7a41d;
}

.feature-icon-box.blue {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

.feature-icon-box.purple {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
}

.feature-icon-box.green {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.6rem 0;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 0.925rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* -- Resources Grid -- */

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.75rem;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.resource-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.resource-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}

.resource-badge.highlight {
  background: rgba(247, 164, 29, 0.12);
  color: var(--brand-primary);
  border-color: rgba(247, 164, 29, 0.3);
}

.resource-arrow {
  color: var(--text-tertiary);
  font-weight: 700;
  transition: transform 0.2s ease, color 0.2s ease;
}

.resource-card:hover .resource-arrow {
  color: var(--brand-primary);
  transform: translateX(4px);
}

.resource-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.resource-card:hover .resource-title {
  color: var(--brand-primary);
}

.resource-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* -- Channels Grid -- */

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.channel-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card-hover);
}

.channel-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.channel-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.channel-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.channel-card:hover .channel-name {
  color: var(--brand-primary);
}

.channel-sub {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -- WeChat Official Box -- */

.wechat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.25rem 2rem;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  margin-top: 2rem;
  box-shadow: var(--shadow-sm);
}

.wechat-desc {
  max-width: 600px;
  margin-bottom: 1.5rem;
}

.wechat-desc h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.wechat-desc p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.wechat-qr-wrap {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wechat-qr-wrap:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.wechat-qr {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* -- CTA Banner -- */

.banner-cta {
  padding: 4.5rem 2rem;
  margin: 2rem 0;
  background: linear-gradient(135deg, rgba(247, 164, 29, 0.08) 0%, rgba(234, 88, 12, 0.04) 100%);
  border: 1px solid rgba(247, 164, 29, 0.2);
  border-radius: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.banner-inner {
  max-width: 680px;
  margin: 0 auto;
}

.banner-cta h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
}

.banner-cta p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0 0 2rem 0;
  line-height: 1.7;
}

.banner-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* -- Responsive Adaptations -- */

@media screen and (max-width: 768px) {
  .hero-title {
    font-size: 2.15rem;
  }
  
  .hero-desc {
    font-size: 1rem;
  }
  
  .wechat-box {
    padding: 1.5rem 1rem;
  }
  
  .banner-cta {
    padding: 3rem 1.25rem;
  }
  
  .banner-cta h2 {
    font-size: 1.5rem;
  }
}

