/* Base styles */
:root {
  --color-primary: #ec5b13;
  --color-primary-rgb: 236, 91, 19;
  --color-paper: #F9F9F7;
  --color-ink: #1A1A1A;
  --color-ink-muted: #6B7280;
  --color-bg-light: #f8f6f6;
  --color-bg-dark: #221610;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-white: #ffffff;
  
  --font-family-serif: 'Noto Serif SC', serif;
  --font-family-display: 'Public Sans', sans-serif;
  --font-family-heading: 'Noto Serif SC', serif;
  
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  /* Theme variables */
  --bg-color: var(--color-bg-light);
  --text-primary: var(--color-ink);
  --text-secondary: var(--color-ink-muted);
  --text-muted: var(--color-ink-muted);
  --border-color: rgba(0, 0, 0, 0.08);
  --card-bg: var(--color-white);
  --header-bg: transparent;
}

[data-theme="dark"] {
  --color-primary: #ec5b13;
  --color-primary-rgb: 236, 91, 19;
  --bg-color: var(--color-bg-dark);
  --text-primary: #F9F9F7;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --border-color: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.03);
  --header-bg: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #ec5b13;
    --color-primary-rgb: 236, 91, 19;
    --bg-color: var(--color-bg-dark);
    --text-primary: #F9F9F7;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.03);
    --header-bg: transparent;
  }
}

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

body {
  font-family: var(--font-family-display);
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.8;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background-color: rgba(var(--color-primary-rgb), 0.3);
}

body.post-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.post-page .post-main {
  flex: 1;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease-in-out;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Homepage - Paper/Ink layout */
.main-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 120px 24px;
  flex: 1;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-link {
  display: inline-block;
}

.article-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.article-list .article-title {
  font-family: var(--font-family-serif);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin: 0;
  transition: color 0.2s ease;
}

.article-meta-line {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.loading-text,
.empty-text {
  color: var(--text-muted);
}

.site-footer {
  padding: 4rem 24px 3rem;
  text-align: center;
}

.site-footer .footer-text {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  opacity: 0.6;
}

.article-card:hover .article-title,
.article-list .article-link:hover .article-title {
  color: var(--color-primary);
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 1.5rem;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 10px 15px -3px rgba(var(--color-primary-rgb), 0.2), 0 4px 6px -4px rgba(var(--color-primary-rgb), 0.1);
}

.btn-primary:hover {
  background-color: rgba(var(--color-primary-rgb), 0.9);
}

/* Post Detail Specifics - 内容宽度 920px */
.post-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 6rem 1.5rem 8rem;
}

@media (min-width: 768px) {
  .post-main {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

@media (min-width: 1024px) {
  .post-main {
    padding-left: 5rem;
    padding-right: 5rem;
  }
}

.post-article {
  display: flex;
  flex-direction: column;
}

.post-header {
  text-align: center;
  margin-bottom: 4rem;
}

.post-title {
  font-family: var(--font-family-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0 0 1rem;
  text-align: center;
}

.post-meta #post-subtitle {
  text-transform: none;
  letter-spacing: 0;
}

.post-excerpt {
  display: none;
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  border-left: 3px solid var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
  text-align: left;
}

.post-excerpt-label {
  font-family: var(--font-family-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0 0 0.5rem;
}

.post-excerpt-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0;
}

@media (min-width: 768px) {
  .post-title {
    font-size: 2.25rem;
  }
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-family-display);
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post-meta-sep {
  color: var(--color-primary);
}

/* 设计规范：正文 18px / 行高 1.8 */
.article-content.prose {
  font-family: var(--font-family-serif);
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* 设计规范：段落间距 24px */
.article-content.prose p {
  margin-bottom: 1.5rem;
}

/* 禁止中文斜体 - 中文无斜体变体，斜体效果不佳 */
[lang="zh"] em, [lang="zh"] i,
[lang="zh-Hans"] em, [lang="zh-Hans"] i,
[lang="zh-CN"] em, [lang="zh-CN"] i {
  font-style: normal;
}

.post-end-icon {
  margin-top: 5rem;
  display: flex;
  justify-content: center;
}

.post-end-icon .material-symbols-outlined {
  font-size: 1.875rem;
  color: rgba(var(--color-primary-rgb), 0.4);
}

.post-footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem;
}

.post-footer .footer-text {
  max-width: 58rem;
  margin: 0 auto;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.prose {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

[data-theme="dark"] .prose {
  color: var(--color-slate-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prose {
    color: var(--color-slate-300);
  }
}

/* 标题层级 */
.prose h1 {
  font-family: var(--font-family-serif);
  font-size: 2.25rem;   /* 36px / H1 - Noto Serif SC Bold */
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.prose h1:first-child {
  margin-top: 0;
}

.prose h2 {
  font-family: var(--font-family-serif);
  font-size: 1.75rem;   /* 28px / H2 */
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.prose h3 {
  font-family: var(--font-family-serif);
  font-size: 1.375rem;  /* 22px / H3 */
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.4;
  color: var(--color-slate-800);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.prose h4 {
  font-family: var(--font-family-serif);
  font-size: 1.125rem;  /* 18px / H4 */
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.4;
  color: var(--color-slate-700);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.prose h5,
.prose h6 {
  font-family: var(--font-family-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-slate-600);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .prose h1,
[data-theme="dark"] .prose h2 {
  color: var(--color-slate-100);
}

[data-theme="dark"] .prose h3 {
  color: var(--color-slate-200);
}

[data-theme="dark"] .prose h4 {
  color: var(--color-slate-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prose h1,
  :root:not([data-theme="light"]) .prose h2 {
    color: var(--color-slate-100);
  }
  :root:not([data-theme="light"]) .prose h3 {
    color: var(--color-slate-200);
  }
  :root:not([data-theme="light"]) .prose h4 {
    color: var(--color-slate-300);
  }
}

.prose p {
  margin-bottom: 1.5rem;
}

.prose blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  color: var(--text-secondary);
  background-color: rgba(var(--color-primary-rgb), 0.05);
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  margin: 2.5rem 0;
}

.prose pre {
  background-color: var(--color-slate-900);
  color: var(--color-slate-200);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  margin-bottom: 2rem;
}

.prose code {
  font-family: monospace;
}

.prose p code {
  background-color: rgba(0,0,0,0.05);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}

[data-theme="dark"] .prose p code {
  background-color: rgba(255,255,255,0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prose p code {
    background-color: rgba(255,255,255,0.1);
  }
}

.prose ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-bottom: 2rem;
}

.prose ul li::marker {
  color: var(--color-primary);
}

.prose ol {
  list-style-type: decimal;
  padding-left: 1.75rem;
  margin-bottom: 2rem;
}

.prose ol li::marker {
  color: var(--color-primary);
  font-weight: 600;
}

.prose li {
  margin-bottom: 0.5rem;
}

.site-brand-link {
  position: fixed;
  left: 1.25rem;
  top: 1.25rem;
  z-index: 1000;
  font-family: var(--font-family-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-brand-link:hover {
  color: var(--color-primary);
  border-color: rgba(var(--color-primary-rgb), 0.6);
}

.theme-toggle-fixed {
  position: fixed;
  right: 1.25rem;
  top: 1.25rem;
  z-index: 1000;
}

.theme-switch {
  width: 3.25rem;
  height: 1.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(44, 94, 142, 0.38);
  background: linear-gradient(180deg, #5ea6da 0%, #3e7fb6 100%);
  box-shadow: inset 0 0.16rem 0.36rem rgba(255, 255, 255, 0.26), inset 0 -0.22rem 0.4rem rgba(7, 32, 57, 0.3), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.18);
  padding: 0;
  position: relative;
  overflow: hidden;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.theme-switch[aria-checked="true"] {
  border-color: rgba(27, 36, 70, 0.6);
  background: linear-gradient(180deg, #1f335d 0%, #111d39 100%);
  box-shadow: inset 0 0.14rem 0.3rem rgba(255, 255, 255, 0.1), inset 0 -0.2rem 0.45rem rgba(2, 7, 18, 0.55), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
}

.theme-switch-scene {
  position: absolute;
  inset: 0;
}

.theme-switch-halo {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 0.55s cubic-bezier(0.56, 1.35, 0.52, 1), opacity 0.4s ease;
}

.theme-switch-halo:nth-child(1) {
  width: 2.55rem;
  height: 2.55rem;
  left: -1.1rem;
  top: -0.78rem;
}

.theme-switch-halo:nth-child(2) {
  width: 3rem;
  height: 3rem;
  left: -1.45rem;
  top: -1.02rem;
  background: rgba(255, 255, 255, 0.09);
}

.theme-switch[aria-checked="true"] .theme-switch-halo {
  opacity: 0;
  transform: translateX(0.75rem);
}

.theme-switch-orb {
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 1.46rem;
  height: 1.46rem;
  border-radius: 50%;
  background: #ffca39;
  box-shadow: 0.12rem 0.12rem 0.28rem rgba(0, 0, 0, 0.3), inset -0.18rem -0.24rem 0.24rem rgba(0, 0, 0, 0.25), inset 0.2rem 0.22rem 0.15rem rgba(255, 236, 143, 0.85);
  transition: transform 0.55s cubic-bezier(0.56, 1.35, 0.52, 1), background 0.35s ease, box-shadow 0.35s ease;
}

.theme-switch[aria-checked="true"] .theme-switch-orb {
  transform: translateX(1.5rem);
  background: #d2d8e6;
  box-shadow: 0.12rem 0.12rem 0.28rem rgba(0, 0, 0, 0.36), inset -0.18rem -0.22rem 0.22rem rgba(0, 0, 0, 0.22), inset 0.2rem 0.22rem 0.14rem rgba(255, 255, 255, 0.7);
}

.theme-switch-crater {
  position: absolute;
  border-radius: 50%;
  background: rgba(130, 142, 166, 0.5);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.theme-switch-crater:nth-child(1) {
  width: 0.26rem;
  height: 0.26rem;
  top: 0.35rem;
  left: 0.84rem;
}

.theme-switch-crater:nth-child(2) {
  width: 0.36rem;
  height: 0.36rem;
  top: 0.68rem;
  left: 0.35rem;
}

.theme-switch-crater:nth-child(3) {
  width: 0.24rem;
  height: 0.24rem;
  top: 0.9rem;
  left: 0.92rem;
}

.theme-switch[aria-checked="true"] .theme-switch-crater {
  opacity: 1;
}

.theme-switch-cloud {
  position: absolute;
  left: 1.62rem;
  top: 0.92rem;
  width: 1.2rem;
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: -0.5rem 0.06rem 0 0 rgba(255, 255, 255, 0.95), -0.15rem -0.14rem 0 0 rgba(255, 255, 255, 0.98);
  transition: transform 0.45s ease, opacity 0.35s ease;
}

.theme-switch[aria-checked="true"] .theme-switch-cloud {
  opacity: 0;
  transform: translateY(0.18rem) scale(0.9);
}

.theme-switch-stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.theme-switch-star {
  position: absolute;
  width: 0.18rem;
  height: 0.18rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0.2rem rgba(255, 255, 255, 0.6);
  animation: theme-star-twinkle 1.9s ease-in-out infinite alternate;
}

.theme-switch-star:nth-child(1) {
  top: 0.36rem;
  left: 1.9rem;
}

.theme-switch-star:nth-child(2) {
  top: 0.66rem;
  left: 2.45rem;
  animation-duration: 2.2s;
}

.theme-switch-star:nth-child(3) {
  top: 1.02rem;
  left: 2rem;
  animation-duration: 1.6s;
}

.theme-switch[aria-checked="true"] .theme-switch-stars {
  opacity: 1;
}

.theme-switch:focus-visible {
  outline: none;
  border-color: rgba(var(--color-primary-rgb), 0.65);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

@keyframes theme-star-twinkle {
  from {
    transform: scale(0.85);
    opacity: 0.55;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .site-brand-link {
    left: 0.875rem;
    top: 0.875rem;
  }

  .theme-toggle-fixed {
    right: 0.875rem;
    top: 0.875rem;
  }
}
