/* =========================================
   1. CSS Variables & Design System
   ========================================= */
:root {
  --bg-color: #f7f7f5;
  --border-color: #1a1a1a;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --bg-invert: #000000;
  --text-invert: #ffffff;
  --code-bg: #111111;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
  --line-height-base: 1.8;
  --ease-out-cubic: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-speed: 0.4s;
  --container-max-width: 1200px;
  --toc-width: 280px;
}
/* 16:9 或更宽屏幕的优化 */
@media (min-width: 1600px) {
  :root {
    --container-max-width: 1400px;
    --toc-width: 320px;
  }
}
@media (min-width: 1920px) {
  :root {
    --container-max-width: 1600px;
    --toc-width: 360px;
  }
}
/* =========================================
   2. Global Reset & Typography
   ========================================= */
* {
  box-sizing: border-box;
  cursor: none !important;
}
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* =========================================
   3. Micro-interactions (Cursor & Reveal)
   ========================================= */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  background-color: #ffffff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease-out-cubic), height 0.2s var(--ease-out-cubic);
  will-change: transform;
}
#custom-cursor.hover-active {
  width: 64px;
  height: 64px;
}
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease-out-cubic), transform 0.8s var(--ease-out-cubic);
}
.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* =========================================
   4. Layout Components
   ========================================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(247, 247, 245, 0.8);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.nav-logo {
  font-weight: 600;
}
.nav-links a {
  margin-left: 24px;
  transition: color 0.3s;
}
.nav-links a:hover {
  color: var(--text-muted);
}
.hero-section {
  height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("/media/images/hero.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
.hero-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(247, 247, 245, 0.75);
  z-index: 1;
}
.hero-section h1 {
  position: relative;
  z-index: 2;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: -0.03em;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.hero-scroll-indicator {
  position: absolute;
  bottom: 30px;
  font-size: 1.2rem;
  animation: float 2s ease-in-out infinite;
  z-index: 2;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}
.intro-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  border-bottom: 1px solid var(--border-color);
}
.intro-left {
  padding: 60px 40px;
  border-right: 1px solid var(--border-color);
}
.intro-left p {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.4;
}
.intro-right {
  padding: 60px 40px;
}
.intro-right p {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.4;
  color: var(--text-main);
}
/* Category Filter */
.category-filter {
  padding: 20px 40px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 20px;
}
.category-filter a {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-muted);
}
.category-filter a:hover {
  color: var(--text-main);
}
/* List Items & Hover Inversion */
.list-item {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-speed) var(--ease-out-cubic), color var(--transition-speed) var(--ease-out-cubic);
}
.list-item:hover {
  background-color: var(--bg-invert);
  color: var(--text-invert);
}
.item-num,
.item-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: border-color var(--transition-speed) var(--ease-out-cubic), color var(--transition-speed) var(--ease-out-cubic);
}
.item-arrow {
  border-right: none;
  border-left: 1px solid var(--border-color);
  font-size: 1.5rem;
}
.list-item:hover .item-num,
.list-item:hover .item-arrow {
  color: var(--text-invert);
  border-color: #333;
}
.item-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.item-content h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: normal;
  margin: 0 0 12px 0;
  transition: transform var(--transition-speed) var(--ease-out-cubic);
}
.item-content p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.item-abstract {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.item-abstract * {
  margin: 0;
  display: inline;
  font-size: inherit;
  font-weight: normal;
  color: inherit;
  line-height: inherit;
  text-decoration: none;
}
.item-abstract br {
  display: none;
}
.item-date {
  font-size: 0.8rem;
  margin-top: 12px;
  color: #666;
  font-family: monospace;
}
.list-item:hover .item-content h3 {
  transform: translateX(12px);
}
/* =========================================
   5. Article Detail & Markdown
   ========================================= */
.post-header {
  padding: 80px 40px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.post-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin: 0 0 20px 0;
  font-weight: normal;
}
.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: "SF Mono", "Fira Code", "Consolas", "Liberation Mono", Monaco, monospace;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.article-layout {
  display: flex;
  flex: 1;
  width: 100%;
}
.markdown-container {
  flex: 1;
  padding: 60px 40px;
  min-width: 0;
}
.markdown-inner {
  max-width: 720px;
}
.markdown-container h1,
.markdown-container h2,
.markdown-container h3 {
  font-family: var(--font-serif);
  font-weight: normal;
  margin-top: 1.8em;
  margin-bottom: 0.8em;
  line-height: 1.3;
}
.markdown-container h1 {
  font-size: 2.2rem;
}
.markdown-container h2 {
  font-size: 1.8rem;
}
.markdown-container h3 {
  font-size: 1.4rem;
}
.markdown-container p {
  margin-bottom: 1.5em;
  font-size: 1.1rem;
  line-height: 1.8;
}
.markdown-container a {
  color: #0055ff;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.3s;
}
.markdown-container a:hover {
  color: #0033cc;
}
.markdown-container ul,
.markdown-container ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
  font-size: 1.1rem;
  line-height: 1.8;
}
.markdown-container li {
  margin-bottom: 0.5em;
}
.markdown-container blockquote {
  border-left: 4px solid var(--border-color);
  margin: 0 0 1.5em 0;
  padding-left: 1em;
  color: var(--text-muted);
  font-style: italic;
}
.markdown-container hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 3em 0;
}
.markdown-container pre {
  background-color: var(--code-bg);
  color: #e0e0e0;
  padding: 24px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.95rem;
  margin: 2em 0;
  border-radius: 4px;
}
.markdown-container table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.markdown-container th,
.markdown-container td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  position: relative;
  margin: 2em 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, var(--bg-color));
  pointer-events: none;
}
.markdown-container img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 3em auto;
  cursor: zoom-in;
}
.toc-container {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 60px 30px;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  border-left: 1px solid var(--border-color);
}
.toc-container ul {
  list-style: none;
  padding-left: 16px;
  margin: 0;
}
.toc-container li {
  margin-bottom: 12px;
}
.toc-container a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.3s;
}
.toc-container a.active-toc {
  color: var(--text-main);
  font-weight: 600;
}
.toc-container a.active-toc::before {
  content: '●';
  margin-right: 8px;
  font-size: 0.8em;
}
.footer {
  padding: 40px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}
/* =========================================
   6. Responsive Fallbacks
   ========================================= */
@media (max-width: 900px) {
  .article-layout {
    flex-direction: column;
  }
  .toc-container {
    display: none;
  }
  .markdown-container {
    margin: 0 auto;
    padding: 40px 20px;
  }
}
@media (max-width: 768px) {
  * {
    cursor: auto !important;
  }
  #custom-cursor {
    display: none !important;
  }
  .container {
    border-left: none;
    border-right: none;
  }
  .intro-section {
    grid-template-columns: 1fr;
  }
  .intro-left {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .list-item {
    grid-template-columns: 60px 1fr 50px;
  }
  .list-item:hover {
    background-color: transparent;
    color: var(--text-main);
  }
  .list-item:active {
    background-color: #ebebea;
  }
  .list-item:hover .item-num,
  .list-item:hover .item-arrow {
    color: var(--text-muted);
    border-color: var(--border-color);
  }
  .list-item:hover .item-content h3 {
    transform: none;
  }
  .navbar,
  .post-header,
  .intro-left,
  .intro-right {
    padding: 20px;
  }
}
