/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Noto Sans SC', 'Source Han Sans CN', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #111827;
  background: #F0FDF4;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
address { font-style: normal; }
ul, ol { list-style: none; }

/* ===== CSS Variables ===== */
:root {
  --c-primary: #16A34A;
  --c-primary-dark: #14532D;
  --c-accent: #F97316;
  --c-accent-deep: #C2410C;
  --c-blue: #1E3A8A;
  --c-bg-soft: #F0FDF4;
  --c-bg-mint: #DCFCE7;
  --c-gray: #6B7280;
  --c-ink: #111827;
  --c-white: #FFFFFF;
  --grad-primary: linear-gradient(135deg, #16A34A 0%, #1E3A8A 100%);
  --grad-cta: linear-gradient(45deg, #F97316 0%, #1E3A8A 100%);
  --grad-progress: linear-gradient(90deg, #16A34A 0%, #F97316 60%, #1E3A8A 100%);
  --font-heading: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Noto Sans SC', 'Source Han Sans CN', 'Microsoft YaHei', sans-serif;
  --font-num: 'DIN Alternate', 'Barlow Condensed', sans-serif;
  --border-w: 4px;
  --radius: 8px;
  --shadow: 8px 8px 24px rgba(17, 24, 39, 0.18);
  --shadow-sm: 4px 4px 12px rgba(17, 24, 39, 0.12);
  --sidebar-w: 240px;
  --header-h: 68px;
  --content-max: 1180px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1.25;
  color: var(--c-ink);
}
h1 { font-size: clamp(32px, 5vw, 48px); letter-spacing: -0.02em; }
h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.01em; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
p { margin-bottom: 1em; }
strong { font-weight: 700; }
small { font-size: 0.875em; }
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ===== Focus & Accessibility ===== */
:focus-visible {
  outline: 3px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.skip-link {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: var(--c-primary-dark);
  color: var(--c-white);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: top 300ms ease-out;
}
.skip-link:focus-visible { top: 0; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Reading Progress ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 4px;
  z-index: 1100;
  background: var(--grad-progress);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

/* ===== Header / Side Track Navigation ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--c-white);
  border-right: var(--border-w) solid var(--c-primary);
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
}
.header-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 20px 24px;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--c-ink);
}
.brand-symbol {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A 0%, #14532D 100%);
  border: 3px solid #16A34A;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
  overflow: hidden;
}
.brand-symbol::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.7);
}
.brand-symbol::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 12px;
  right: -4px;
  bottom: 3px;
  background: linear-gradient(135deg, var(--c-accent), #EA580C);
  border-radius: 4px;
  transform: rotate(-18deg);
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
}
.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-tagline {
  font-size: 11px;
  color: var(--c-gray);
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.nav-toggle {
  display: none;
  width: 46px;
  height: 46px;
  padding: 10px;
  background: var(--c-white);
  border: 3px solid var(--c-primary-dark);
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 300ms ease-out;
}
.nav-toggle:hover { background: var(--c-bg-soft); }
.nav-toggle-track {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}
.nav-toggle-bar {
  height: 3px;
  width: 100%;
  background: var(--c-primary-dark);
  border-radius: 3px;
  transition: transform 300ms ease-out, opacity 300ms ease-out;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
.nav-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 32px;
}
.site-nav { width: 100%; }
.nav-list { list-style: none; }
.nav-item + .nav-item { margin-top: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-ink);
  border-left: 4px solid transparent;
  text-decoration: none;
  transition: background 300ms ease-out, color 300ms ease-out, border-color 300ms ease-out, padding-left 300ms ease-out;
}
.nav-link:hover {
  background: var(--c-bg-soft);
  color: var(--c-primary-dark);
  border-left-color: var(--c-primary);
}
.nav-link[aria-current="page"],
.nav-link.is-active {
  background: linear-gradient(135deg, var(--c-bg-soft), var(--c-bg-mint));
  color: var(--c-primary-dark);
  border-left-color: var(--c-primary-dark);
  font-weight: 900;
}
.nav-num {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-accent);
  letter-spacing: 0.06em;
  min-width: 22px;
}
.nav-aux {
  margin-top: 32px;
  border-top: 3px solid var(--c-bg-soft);
  padding-top: 20px;
}
.old-entry-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--c-white);
  border: 3px solid var(--c-primary-dark);
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-primary-dark);
  cursor: pointer;
  transition: background 300ms ease-out, transform 300ms ease-out;
}
.old-entry-btn:hover { background: var(--c-bg-soft); }
.old-entry-btn[aria-expanded="true"] { background: var(--c-bg-soft); }
.old-entry-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
  animation: dotPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0.08); }
}
.old-entry-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: var(--c-bg-soft);
  border: 3px solid var(--c-primary);
  border-radius: var(--radius);
  transition: max-height 300ms ease-out, opacity 300ms ease-out, margin 300ms ease-out, padding 300ms ease-out;
  margin: 0;
  padding: 0;
}
.old-entry-panel[data-open] {
  max-height: 320px;
  opacity: 1;
  margin-top: 12px;
  padding: 14px 16px;
}
.old-entry-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  color: var(--c-primary-dark);
  margin-bottom: 6px;
}
.old-entry-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--c-ink);
  margin: 0;
}

/* ===== Main ===== */
main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* ===== Container & Sections ===== */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: 32px;
}
.section { padding-block: 80px; }
.chapter {
  position: relative;
  padding-block: 96px;
  border-top: var(--border-w) solid var(--c-primary-dark);
}
.chapter:first-of-type { border-top: none; }
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-accent-deep);
  margin-bottom: 16px;
}
.section-label::before {
  content: '';
  width: 28px;
  height: 4px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-primary));
  border-radius: 4px;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: 24px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 26px;
  border-radius: var(--radius);
  border: 3px solid transparent;
  background: transparent;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 300ms ease-out, box-shadow 300ms ease-out, background 300ms ease-out, color 300ms ease-out;
}
.btn-primary {
  background: var(--c-primary);
  color: var(--c-white);
  border-color: var(--c-primary-dark);
  box-shadow: 4px 4px 0 var(--c-primary-dark);
}
.btn-primary:hover {
  background: var(--c-primary-dark);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--c-primary-dark);
}
.btn-accent {
  background: var(--grad-cta);
  color: var(--c-white);
  border-color: var(--c-blue);
  box-shadow: 4px 4px 0 var(--c-blue);
}
.btn-accent:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--c-blue);
}
.btn-outline {
  background: var(--c-white);
  color: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  box-shadow: 4px 4px 0 var(--c-bg-mint);
}
.btn-outline:hover {
  background: var(--c-bg-soft);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--c-bg-mint);
}

/* ===== Tags ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  background: var(--c-bg-soft);
  border: 2px solid var(--c-primary);
  color: var(--c-primary-dark);
}
.tag-accent {
  background: #FFF7ED;
  border-color: var(--c-accent);
  color: var(--c-accent-deep);
}
.tag-blue {
  background: #EFF6FF;
  border-color: var(--c-blue);
  color: var(--c-blue);
}

/* ===== Cards & Panels ===== */
.card {
  background: var(--c-white);
  border: var(--border-w) solid var(--c-primary-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  transition: transform 300ms ease-out, box-shadow 300ms ease-out;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 12px 12px 32px rgba(17, 24, 39, 0.22);
}
.card-accent {
  border-color: var(--c-accent);
}
.status-panel {
  border: var(--border-w) solid var(--c-primary-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--c-white);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.status-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent), var(--c-blue));
}
.status-panel-title {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-gray);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ===== Image Frame Placeholder ===== */
.img-frame {
  background: linear-gradient(135deg, #14532D 0%, #16A34A 55%, #1E3A8A 130%);
  border: var(--border-w) solid var(--c-primary-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-frame::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -60%;
  width: 220%;
  height: 220%;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.07) 0px,
    rgba(255, 255, 255, 0.07) 10px,
    transparent 10px,
    transparent 28px
  );
}
.img-frame::after {
  content: '';
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  position: relative;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 65%);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--c-gray);
  padding-block: 16px;
}
.breadcrumbs a {
  color: var(--c-primary-dark);
  text-decoration: none;
  font-weight: 500;
  transition: color 300ms ease-out;
}
.breadcrumbs a:hover { color: var(--c-accent); }
.breadcrumbs-sep { color: var(--c-gray); opacity: 0.6; }
.breadcrumbs-current {
  color: var(--c-gray);
  font-weight: 500;
}

/* ===== Divider ===== */
.divider {
  border: none;
  height: 4px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-blue));
  border-radius: 4px;
  margin-block: 32px;
}

/* ===== Footer ===== */
.site-footer {
  margin-left: var(--sidebar-w);
  background: linear-gradient(150deg, #14532D 0%, #0D3B1E 55%, #172E5C 130%);
  color: rgba(255, 255, 255, 0.85);
  border-top: var(--border-w) solid var(--c-primary);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 64px 32px 28px;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 1.2fr;
  gap: 40px;
}
.brand-link-footer {
  color: var(--c-white);
}
.brand-link-footer .brand-name { color: var(--c-white); }
.brand-link-footer .brand-tagline { color: rgba(255, 255, 255, 0.6); }
.brand-link-footer .brand-symbol {
  border-color: #4ADE80;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.25);
}
.footer-intro {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
  margin: 16px 0 0;
}
.footer-col { min-width: 0; }
.footer-heading {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 900;
  color: var(--c-white);
  letter-spacing: 0.06em;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--c-accent);
}
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 14px;
  transition: color 300ms ease-out, padding-left 300ms ease-out;
}
.footer-links a:hover {
  color: var(--c-white);
  padding-left: 4px;
}
.footer-note {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 20px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}
.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}
.footer-contact a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 300ms ease-out;
}
.footer-contact a:hover { color: var(--c-white); }
.contact-note {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 8px;
  margin-top: 4px;
  line-height: 1.6;
}
.footer-update {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.5;
}
.update-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  margin-top: 5px;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
  animation: dotPulse 2s ease-in-out infinite;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.14);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  :root {
    --sidebar-w: 216px;
  }
  .header-inner { padding-inline: 16px; }
  .brand-name { font-size: 18px; }
  .nav-link { font-size: 14px; padding: 10px 10px; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 960px) {
  main {
    margin-left: 0;
    padding-top: var(--header-h);
  }
  .site-footer {
    margin-left: 0;
  }
  .reading-progress {
    left: 0;
  }
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: var(--header-h);
    border-right: none;
    border-bottom: var(--border-w) solid var(--c-primary);
    box-shadow: 0 4px 16px rgba(17, 24, 39, 0.08);
    overflow: visible;
  }
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 16px;
  }
  .brand-symbol {
    width: 36px;
    height: 36px;
  }
  .brand-tagline { display: none; }
  .nav-toggle {
    display: inline-flex;
    margin-left: 16px;
  }
  .nav-wrap {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(340px, 86vw);
    background: var(--c-white);
    border-right: var(--border-w) solid var(--c-primary);
    padding: 32px 24px;
    transform: translateX(-110%);
    visibility: hidden;
    opacity: 0;
    transition: transform 300ms ease-out, opacity 300ms ease-out, visibility 0s linear 300ms;
    z-index: 999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 0;
    box-shadow: 8px 0 24px rgba(17, 24, 39, 0.12);
  }
  .nav-wrap[data-open] {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
    transition: transform 300ms ease-out, opacity 300ms ease-out, visibility 0s;
  }
  .nav-aux {
    margin-top: 28px;
  }
  .section { padding-block: 56px; }
  .chapter { padding-block: 64px; }
  .container { padding-inline: 24px; }
  .footer-inner { padding-inline: 24px; }
}
@media (max-width: 640px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-bottom {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
  .section { padding-block: 40px; }
  .chapter { padding-block: 48px; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .nav-wrap {
    transition: none;
  }
  .card:hover,
  .btn:hover {
    transform: none;
  }
  .reading-progress {
    transition: none;
  }
}
