/* ============================================================
   个人法治学习园地 — 样式系统
   设计体系对齐 lawyer-ui-v3，适配 Web 阅读场景
   ============================================================ */

/* ----------------------------------------------------------
   CSS Variables — 与 lawyer-ui-v3 同源
   ---------------------------------------------------------- */

:root {
  /* Background */
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.85);

  /* Text */
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;

  /* Accent */
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;

  /* Border */
  --border-default: #e5e7eb;
  --border-light: #f3f4f6;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;

  /* Layout */
  --max-width-content: 820px;
  --max-width-wide: 960px;
  --header-height: 56px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ----------------------------------------------------------
   Dark Mode
   ---------------------------------------------------------- */

.dark {
  --bg-page: #121212;
  --bg-card: #1e1e24;
  --bg-header: rgba(18, 18, 18, 0.88);

  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-muted: #4a4a60;

  --border-default: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.05);

  --shadow-sm: none;
  --shadow-card: none;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);

  --accent-blue: #60a5fa;
  --accent-blue-hover: #93bbfd;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-amber: #fbbf24;
}

/* ----------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------- */

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* ----------------------------------------------------------
   Focus & Accessibility
   ---------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--accent-blue);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-size: 14px;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 8px;
}

/* ----------------------------------------------------------
   Typography
   ---------------------------------------------------------- */

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 2em; }
h3 { font-size: 1.2rem; margin-top: 1.5em; }
h2:first-child,
h3:first-child { margin-top: 0; }

p {
  margin-bottom: 0.75em;
  line-height: 1.8;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-blue-hover);
}

strong {
  font-weight: 600;
}

blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: 12px 20px;
  margin: 1.5em 0;
  background: var(--border-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ----------------------------------------------------------
   Site Header
   ---------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  height: var(--header-height);
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.header-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
  transition: opacity var(--transition-fast);
}

.site-logo:hover {
  opacity: 0.8;
}

.logo-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.logo-text {
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

.nav-link.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 500;
}

/* Theme Toggle Button */

.theme-toggle {
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: 8px;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.theme-toggle .icon-moon { display: none; }
.dark .theme-toggle .icon-moon { display: block; }
.dark .theme-toggle .icon-sun { display: none; }

/* ----------------------------------------------------------
   Main Content Area
   ---------------------------------------------------------- */

.site-main {
  flex: 1;
  width: 100%;
}

/* ----------------------------------------------------------
   Hero Section
   ---------------------------------------------------------- */

.hero {
  padding: 80px 24px 64px;
  text-align: center;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: var(--accent-blue);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.hero-cta:hover {
  background: var(--accent-blue-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.35);
}

.hero-cta:active {
  transform: translateY(0);
}

/* ----------------------------------------------------------
   Sections
   ---------------------------------------------------------- */

.section {
  padding: 48px 24px;
}

.section-alt {
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.section-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
}

.section-header {
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   Feature Cards (Homepage)
   ---------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-normal);
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  line-height: 1;
}

.feature-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.feature-count {
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 500;
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ----------------------------------------------------------
   Update List (Homepage)
   ---------------------------------------------------------- */

.update-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.update-item {
  border-bottom: 1px solid var(--border-light);
}

.update-item:last-child {
  border-bottom: none;
}

.update-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.update-link:hover {
  color: var(--accent-blue);
}

.update-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  background: var(--border-light);
  color: var(--text-tertiary);
}

.tag-laws { background: rgba(59, 130, 246, 0.08); color: var(--accent-blue); }
.tag-interpretations { background: rgba(16, 185, 129, 0.08); color: var(--accent-green); }
.tag-study { background: rgba(245, 158, 11, 0.08); color: var(--accent-amber); }

.update-title {
  flex: 1;
  font-size: 0.95rem;
}

.update-date {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

/* ----------------------------------------------------------
   Breadcrumb
   ---------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--accent-blue);
}

.breadcrumb-sep {
  color: var(--text-muted);
  user-select: none;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ----------------------------------------------------------
   Page Title
   ---------------------------------------------------------- */

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   Item List (category listing)
   ---------------------------------------------------------- */

.item-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--border-default);
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.item-card:hover {
  background: rgba(59, 130, 246, 0.02);
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.item-card:hover .item-title {
  color: var(--accent-blue);
}

.item-summary {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin: 4px 0 0 0;
  line-height: 1.5;
}

.item-date {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------------
   Article Layout (detail page)
   ---------------------------------------------------------- */

.article-layout {
  max-width: var(--max-width-content);
}

.article-header {
  margin-bottom: 36px;
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}

.article-date {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

/* Article body — rendered from Markdown */

.article-content {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-primary);
}

.article-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2.5em;
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-default);
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.article-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
  color: var(--text-secondary);
}

.article-content p {
  margin-bottom: 1em;
  line-height: 1.85;
}

.article-content ul,
.article-content ol {
  margin: 0.75em 0 1em 1.5em;
  line-height: 1.85;
}

.article-content li {
  margin-bottom: 0.3em;
}

.article-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 2em 0;
}

/* Article content — Law article numbers (bold text at line start) */
.article-content p strong:first-child {
  color: var(--accent-blue);
  font-weight: 600;
}

/* ----------------------------------------------------------
   Empty State
   ---------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ----------------------------------------------------------
   Site Footer
   ---------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border-default);
  background: var(--bg-card);
  padding: 32px 24px;
  margin-top: auto;
  transition: background var(--transition-normal);
}

.footer-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.footer-info {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.7;
}

.footer-info p {
  margin-bottom: 2px;
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
}

.beian-item {
  white-space: nowrap;
}

.beian-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.footer-contact {
  margin-top: 4px;
}

.footer-contact a {
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-contact a:hover {
  color: var(--accent-blue);
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.footer-links a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-blue);
}

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */

@media (max-width: 768px) {
  html { font-size: 16px; }

  .hero { padding: 56px 20px 48px; }
  .hero-title { font-size: 1.8rem; }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section { padding: 32px 16px; }

  .site-nav { gap: 0; }
  .nav-link { padding: 6px 10px; font-size: 0.8rem; }

  .header-inner { padding: 0 16px; }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
  }

  .article-title { font-size: 1.5rem; }

  .update-link {
    flex-wrap: wrap;
    gap: 8px;
  }

  .update-date {
    min-width: auto;
    text-align: left;
  }

  .item-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .page-title { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .logo-text { display: none; }
  .hero-title { font-size: 1.5rem; }
  .hero-cta { width: 100%; }
}

/* ----------------------------------------------------------
   Print Styles — clean print for legal texts
   ---------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .skip-link,
  .breadcrumb,
  .hero-cta { display: none; }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
    line-height: 1.6;
  }

  .article-content {
    max-width: 100%;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
