/* ================================================================
   AIAS Modern Design System
   Inspired by Apple design language — clean, airy, focused.
   ================================================================ */

/* --- CSS Variables --- */
:root {
  /* Brand — blue Apple-inspired palette */
  --primary: #0071e3;
  --primary-dark: #005ecb;
  --secondary: #2997ff;
  --glow: rgba(0, 113, 227, 0.16);
  --danger: #ff3b30;

  /* Neutrals */
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-soft: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-strong: #515154;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.10);
  --shadow-glow: 0 10px 22px rgba(0, 113, 227, 0.25);

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

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 20px;
  --radius-full: 999px;

  /* Layout */
  --max: 1140px;
  --header-height: 64px;

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

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 120%, rgba(41, 151, 255, 0.12), transparent 44%),
    radial-gradient(circle at 15% 0%, rgba(0, 113, 227, 0.08), transparent 38%),
    radial-gradient(circle at 85% 0%, rgba(41, 151, 255, 0.06), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(0, 113, 227, 0.05), transparent 45%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Reset margins on layout containers only */
header, footer, nav, .hero, section, .section-head, .card, .stat, .contact-panel,
.site-header, .site-footer, .site-nav, .container, .hero-content, .card-body,
.contact-grid, .contact-item, .page-header, .category-tabs, .grid, .breadcrumb,
.back-link, .lang-switch, .mesh {
  margin: 0;
  padding: 0;
}

[id] {
  scroll-margin-top: 90px;
}

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

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Only remove list-style from navigation elements */
.site-nav, .site-nav ul, .site-nav ol, .sidebar-nav, .sidebar-nav ul,
nav ul, nav ol, .links, .links ul, .breadcrumb ul, .hero-actions,
.category-tabs {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --- Mesh Background --- */
.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.45), transparent 78%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.45), transparent 78%);
}

/* --- Container --- */
.container {
  width: min(92vw, var(--max));
  margin: 0 auto;
}

/* ================================================================
   Navigation
   ================================================================ */
.site-header {
  position: sticky;
  top: 10px;
  z-index: 100;
  margin: 10px auto 0;
  width: min(94vw, var(--max));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-base);
}

/* Brand */
.site-logo {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  font-size: 16px;
}

.site-logo img {
  height: 36px;
  width: auto;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
  flex-shrink: 0;
}

/* Nav right area */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Language Switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--muted);
  transition: all var(--transition-base);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.lang-switch:hover {
  background: rgba(0, 113, 227, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.lang-switch .lang-option {
  transition: all var(--transition-base);
  padding: 2px 4px;
  border-radius: 4px;
}

.lang-switch .lang-option.active {
  color: var(--primary);
  background: rgba(0, 113, 227, 0.12);
}

.lang-switch .lang-divider {
  color: var(--line);
}

/* Nav Links */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.site-nav > li > a,
.site-nav > a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 14px;
  transition: all var(--transition-base);
  white-space: nowrap;
  display: inline-block;
}

.site-nav > li > a:hover,
.site-nav > a:hover,
.site-nav > li > a.active,
.site-nav > a.active {
  color: var(--text);
  background: rgba(0, 113, 227, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.14);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* ================================================================
   Hero Section
   ================================================================ */
.hero {
  padding: 88px 0 54px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: end;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: 10px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle at center, var(--glow), transparent 68%);
  animation: floatGlow 7s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #111111 8%, #005ecb 52%, #1d1d1f 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  font-size: clamp(15px, 2vw, 18px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 10px 18px;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s, border-color 0.25s;
  font-size: 15px;
  cursor: pointer;
  line-height: 1.5;
}

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

.btn-primary {
  color: #ffffff;
  background: linear-gradient(130deg, #0071e3, #1c8cff);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(0, 113, 227, 0.35);
}

.btn-outline {
  color: var(--text);
  border-color: var(--line);
  background: #ffffff;
}

.btn-outline:hover {
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.12);
  color: var(--text);
}

/* Hero visual */
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-visual img {
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  left: -40%;
  top: -120%;
  width: 70%;
  height: 300%;
  background: linear-gradient(180deg, transparent, rgba(0, 113, 227, 0.08), transparent);
  transform: rotate(22deg);
}

.stat .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
}

.stat .label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ================================================================
   Sections
   ================================================================ */
section {
  padding: 38px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
  font-size: 14px;
  text-align: right;
}

/* Smaller section titles */
#products .section-head h2,
#guides .section-head h2,
#contact .section-head h2 {
  font-size: clamp(20px, 2.2vw, 30px);
}

/* ================================================================
   Category Tabs
   ================================================================ */
.category-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.category-tabs span {
  display: inline-flex;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  transition: all var(--transition-base);
}

.category-tabs span.active {
  color: #fff;
  background: linear-gradient(130deg, #0071e3, #1c8cff);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

/* ================================================================
   Card Grid
   ================================================================ */
.grid {
  display: grid;
  gap: 14px;
}

.cards-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(170deg, #ffffff, #fafafa);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  min-height: 220px;
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
  display: flex;
  flex-direction: column;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.18), transparent 45%, rgba(41, 151, 255, 0.14)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 113, 227, 0.22);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 113, 227, 0.1);
}

.card img {
  width: 100%;
  height: 158px;
  object-fit: cover;
  display: block;
  filter: saturate(1.03);
}

.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card h3 {
  margin: 0;
  font-size: 18px;
}

.card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}

.card a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  margin-top: auto;
}

.card a:hover {
  color: var(--primary-dark);
}

/* Card without image */
.card-no-img {
  min-height: auto;
}

/* ================================================================
   Contact Panel
   ================================================================ */
.contact-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 22px;
  background:
    radial-gradient(circle at 95% 0%, rgba(0, 113, 227, 0.08), transparent 32%),
    linear-gradient(145deg, #ffffff, #f7f9fc);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.07);
  position: relative;
  overflow: hidden;
}

.contact-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at center, rgba(41, 151, 255, 0.18), transparent 70%);
  pointer-events: none;
}

.contact-title {
  margin: 0;
  font-size: 20px;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.contact-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 14px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.contact-item:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 113, 227, 0.28);
  box-shadow: 0 8px 18px rgba(0, 113, 227, 0.12);
}

.contact-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0071e3, #5bb4ff);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.contact-label {
  display: block;
  color: var(--muted-strong);
  font-size: 12px;
  margin-bottom: 2px;
}

.contact-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.contact-value a {
  color: var(--primary);
  text-decoration: none;
}

.contact-value a:hover {
  color: var(--primary-dark);
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--primary);
}

/* ================================================================
   Reveal Animations
   ================================================================ */
@keyframes floatGlow {
  0%   { transform: translateY(0px) scale(1);   opacity: 0.9; }
  50%  { transform: translateY(-16px) scale(1.05); opacity: 0.7; }
  100% { transform: translateY(0px) scale(1);   opacity: 0.9; }
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   Page Header (for sub-pages)
   ================================================================ */
.page-header {
  padding: calc(var(--header-height) + var(--space-3xl)) 0 var(--space-3xl);
  background: var(--bg);
  text-align: center;
}

.page-header .section-title {
  font-size: 32px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.breadcrumb a {
  color: var(--muted);
}

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

.breadcrumb .sep {
  color: var(--line);
}

.breadcrumb .current {
  color: var(--primary);
}

/* ================================================================
   Detail Content (for standalone product/guide pages)
   ================================================================ */
.detail-content {
  color: #333;
  font-size: 15px;
  line-height: 1.8;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.detail-content h1,
.detail-content h2,
.detail-content h3,
.detail-content h4 {
  color: var(--text);
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  font-weight: 600;
  line-height: 1.3;
}

.detail-content h1 { font-size: 2rem; }
.detail-content h2 { font-size: 1.6rem; }
.detail-content h3 { font-size: 1.3rem; }

.detail-content p {
  margin: 0.8em 0;
}

.detail-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: var(--space-md) auto;
}

.detail-content pre {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: var(--space-md) 0;
}

.detail-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.detail-content :not(pre) > code {
  background: var(--bg);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
}

.detail-content table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-md) 0;
  font-size: 14px;
}

.detail-content th,
.detail-content td {
  border: 1px solid var(--line);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
}

.detail-content th {
  background: var(--panel-soft);
  font-weight: 600;
}

.detail-content blockquote {
  border-left: 3px solid var(--primary);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  color: var(--muted);
  background: var(--panel-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.detail-content a {
  color: var(--primary);
}

.detail-content ul,
.detail-content ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
  list-style: revert;
}

/* --- Content area for sub-pages (Typora / VNote exports) --- */
#write,
#post-content,
#vx-content,
.typora-export-content,
.typora-export {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px;
  padding-bottom: 60px;
  font-size: 16px;
  line-height: 1.7;
  color: #333;
}

@media only screen and (min-width: 1400px) {
  #write, #post-content, #vx-content,
  .typora-export-content, .typora-export { max-width: 1024px; }
}
@media only screen and (min-width: 1800px) {
  #write, #post-content, #vx-content,
  .typora-export-content, .typora-export { max-width: 1200px; }
}

/* --- Headings --- */
#write h1, #post-content h1, #vx-content h1,
.typora-export h1, .typora-export-content h1 {
  font-size: 2rem; font-weight: 700; margin: 1.4em 0 0.6em;
  padding-bottom: 0.3em; border-bottom: 1px solid var(--line);
  color: var(--text); line-height: 1.3;
}
#write h2, #post-content h2, #vx-content h2,
.typora-export h2, .typora-export-content h2 {
  font-size: 1.6rem; font-weight: 700; margin: 1.3em 0 0.5em;
  padding-bottom: 0.25em; border-bottom: 1px solid var(--line);
  color: var(--text); line-height: 1.3;
}
#write h3, #post-content h3, #vx-content h3,
.typora-export h3, .typora-export-content h3 {
  font-size: 1.35rem; font-weight: 700; margin: 1.2em 0 0.5em;
  color: var(--text); line-height: 1.35;
}
#write h4, #post-content h4, #vx-content h4,
.typora-export h4, .typora-export-content h4 {
  font-size: 1.15rem; font-weight: 700; margin: 1.1em 0 0.4em;
  color: var(--text); line-height: 1.4;
}
#write h5, #post-content h5, #vx-content h5,
.typora-export h5, .typora-export-content h5 {
  font-size: 1rem; font-weight: 700; margin: 1em 0 0.4em;
  color: var(--muted-strong); line-height: 1.5;
}
#write h6, #post-content h6, #vx-content h6,
.typora-export h6, .typora-export-content h6 {
  font-size: 0.95rem; font-weight: 600; margin: 1em 0 0.4em;
  color: var(--muted); line-height: 1.5;
}

/* --- Paragraphs & Lists --- */
#write p, #post-content p, #vx-content p,
.typora-export p, .typora-export-content p {
  margin: 0.8em 0;
}
#write ul, #write ol, #post-content ul, #post-content ol,
#vx-content ul, #vx-content ol,
.typora-export ul, .typora-export ol,
.typora-export-content ul, .typora-export-content ol {
  padding-left: 1.8em; margin: 0.6em 0; list-style: revert;
}
#write li, #post-content li, #vx-content li,
.typora-export li, .typora-export-content li {
  margin: 0.3em 0; line-height: 1.7;
}

/* --- Links --- */
#write a, #post-content a, #vx-content a,
.typora-export a, .typora-export-content a {
  color: var(--primary); text-decoration: none;
}
#write a:hover, #post-content a:hover, #vx-content a:hover,
.typora-export a:hover, .typora-export-content a:hover {
  text-decoration: underline;
}

/* --- Images --- */
#write img, #post-content img, #vx-content img,
.typora-export img, .typora-export-content img {
  max-width: 100%; height: auto;
}

/* --- Horizontal Rule --- */
#write hr, #post-content hr, #vx-content hr,
.typora-export hr, .typora-export-content hr {
  height: 2px; padding: 0; margin: 24px 0;
  background: var(--line); border: 0; overflow: hidden;
}

/* --- Blockquote --- */
#write blockquote, #post-content blockquote, #vx-content blockquote,
.typora-export blockquote, .typora-export-content blockquote {
  margin: 1rem 0; padding: 0 1em;
  border-left: 4px solid #dfe2e5; color: var(--muted);
}

/* --- Inline Code --- */
#write code, #post-content code, #vx-content code,
.typora-export code, .typora-export-content code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: #f3f4f4; padding: 2px 6px; border-radius: 4px;
  color: #8e24aa; word-break: break-word;
}
#write pre code, #post-content pre code, #vx-content pre code,
.typora-export pre code, .typora-export-content pre code {
  background: transparent; padding: 0; border-radius: 0;
  color: inherit; font-size: inherit;
}

/* --- Code Blocks / Pre --- */
#write pre, #post-content pre, #vx-content pre,
.typora-export pre, .typora-export-content pre {
  margin: 1rem 0; padding: 1em; overflow-x: auto;
  background: #f8f8f8; border: 1px solid #e7eaed; border-radius: 6px;
  font-size: 0.9em; line-height: 1.55; tab-size: 4;
}

/* --- Tables --- */
#write table, #post-content table, #vx-content table,
.typora-export table, .typora-export-content table {
  border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95em;
}
#write thead, #post-content thead, #vx-content thead,
.typora-export thead, .typora-export-content thead,
#write tr:nth-child(2n), #post-content tr:nth-child(2n), #vx-content tr:nth-child(2n),
.typora-export tr:nth-child(2n), .typora-export-content tr:nth-child(2n) {
  background: #f8f8f8;
}
#write th, #post-content th, #vx-content th,
.typora-export th, .typora-export-content th {
  font-weight: 600; text-align: left;
}
#write th, #write td, #post-content th, #post-content td,
#vx-content th, #vx-content td,
.typora-export th, .typora-export td,
.typora-export-content th, .typora-export-content td {
  border: 1px solid #dfe2e5; padding: 8px 13px;
}

/* --- CodeMirror / VNote code fences --- */
.CodeMirror {
  font-family: var(--font-mono); font-size: 0.9em; line-height: 1.55;
}
.md-fences {
  display: block; break-inside: avoid; white-space: pre;
  background: #f8f8f8; border: 1px solid #e7eaed; border-radius: 6px;
  padding: 1em; margin: 1rem 0; font-size: 0.9em; line-height: 1.55;
  overflow-x: auto;
}
div.code-toolbar > .toolbar { display: none; }

/* --- VNote alerts --- */
.vx-alert, .alert-primary, .alert-secondary, .alert-success,
.alert-info, .alert-warning, .alert-danger, .alert-light, .alert-dark {
  position: relative; padding: 0.75rem 1.25rem; margin-bottom: 1rem;
  border: 1px solid transparent; border-radius: 0.5rem;
}
.alert-primary { color: #004085; background: #cce5ff; border-color: #b8daff; }
.alert-success { color: #155724; background: #d4edda; border-color: #c3e6cb; }
.alert-info    { color: #0c5460; background: #d1ecf1; border-color: #bee5eb; }
.alert-warning { color: #856404; background: #fff3cd; border-color: #ffeeba; }
.alert-danger  { color: #721c24; background: #f8d7da; border-color: #f5c6cb; }

.detail-content li {
  margin: 0.3em 0;
}

/* Back button for detail pages */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
  cursor: pointer;
}

.back-link:hover {
  color: var(--primary);
}

/* Two Column Layout (for sub-pages) */
.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-2xl);
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
  align-self: start;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--panel-soft);
  color: var(--primary);
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero::after {
    right: -20px;
    width: 180px;
    height: 180px;
  }

  .cards-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: sticky;
    flex-wrap: wrap;
  }

  .menu-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    margin-top: 4px;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav > li > a,
  .site-nav > a {
    width: 100%;
    padding: 10px 12px;
  }

  .nav-right {
    flex-wrap: wrap;
  }

  .cards-4,
  .cards-3,
  .cards-2,
  .contact-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 40px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head p {
    text-align: left;
  }

  .lang-switch {
    font-size: 12px;
    padding: 4px 8px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 15px;
  }
}
