/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
body { margin: 0; font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; background: var(--color-bg-soft); color: var(--color-text); line-height: 1.6; font-weight: 400; -webkit-font-smoothing: antialiased; }
img, svg, video { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; background: none; border: none; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }

:root {
  --color-primary: #0A1E3F;
  --color-primary-deep: #071530;
  --color-secondary: #1B3B6F;
  --color-accent: #FF6A00;
  --color-accent-soft: #FF9A45;
  --color-bg-soft: #EDF2F7;
  --color-text: #1A202C;
  --color-text-muted: #718096;
  --color-line: #CBD5E0;
  --color-white: #FFFFFF;
  --font-heading: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", "Consolas", "Menlo", monospace;
  --space-header: 280px;
  --radius-card: 12px;
  --radius-element: 8px;
  --shadow-card: 0 1px 3px rgba(10, 30, 63, 0.06), 0 4px 16px rgba(10, 30, 63, 0.05);
  --shadow-card-hover: 0 6px 20px rgba(10, 30, 63, 0.10);
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration: 240ms;
  --content-max: 1280px;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.375rem;
}

/* ===== Skip link ===== */
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 200; background: var(--color-accent); color: var(--color-white); padding: 10px 18px; border-radius: 0 0 var(--radius-element) var(--radius-element); font-weight: 700; transition: top var(--duration) var(--ease-out); }
.skip-link:focus-visible { top: 0; }

/* ===== Progress track ===== */
.progress-track { position: fixed; top: 0; left: 0; height: 4px; width: 100%; background: transparent; z-index: 150; pointer-events: none; }
.progress-track::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 0; background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-soft) 100%); border-radius: 0 2px 2px 0; transition: width 120ms linear; will-change: width; }

/* ===== Header Layout ===== */
.l-header { position: fixed; inset: 0 auto 0 0; width: var(--space-header); background: var(--color-primary); color: var(--color-white); z-index: 100; display: flex; flex-direction: column; }
.header-side { display: flex; flex-direction: column; flex: 1; padding: 32px 28px 28px; overflow-y: auto; }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 44px; }
.brand__mark { display: flex; align-items: flex-end; gap: 3px; width: 34px; height: 34px; position: relative; }
.brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); margin-bottom: 4px; }
.brand__line { width: 22px; height: 4px; background: var(--color-accent-soft); border-radius: 4px; margin-bottom: 2px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: 1.375rem; font-weight: 900; letter-spacing: 0.02em; color: var(--color-white); }
.brand__tagline { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.22em; color: var(--color-accent-soft); margin-top: 2px; }

/* Navigation */
.site-nav { flex: 1; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-link { position: relative; display: block; padding: 11px 14px 11px 18px; font-size: var(--text-md); font-weight: 500; color: rgba(255,255,255,0.78); border-radius: var(--radius-element); transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out); }
.nav-link::before { content: ""; position: absolute; left: 0; top: 20%; height: 60%; width: 3px; background: var(--color-accent); border-radius: 0 3px 3px 0; transform: scaleY(0); transform-origin: center; transition: transform var(--duration) var(--ease-out); }
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--color-white); }
.nav-link:hover::before { transform: scaleY(0.55); }
.nav-link[aria-current="page"] { background: rgba(255,106,0,0.12); color: var(--color-white); font-weight: 700; }
.nav-link[aria-current="page"]::before { transform: scaleY(1); }
.nav-link[aria-current="page"]::after { content: attr(data-nav-index); margin-left: 8px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent-soft); }

/* Sidebar footer block */
.header-side__foot { margin-top: auto; padding-top: 32px; border-top: 1px solid rgba(255,255,255,0.08); }
.header-side__version { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent-soft); letter-spacing: 0.06em; text-transform: uppercase; }
.version-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); }
.version-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--color-accent); opacity: 0.6; }
.header-side__note { margin-top: 8px; font-size: var(--text-xs); color: rgba(255,255,255,0.55); line-height: 1.5; }

/* Topbar (page status) */
.header-topbar { position: fixed; top: 0; left: var(--space-header); right: 0; height: 64px; z-index: 90; background: rgba(237,242,247,0.72); backdrop-filter: blur(10px); border-bottom: 1px solid var(--color-line); display: flex; align-items: center; justify-content: space-between; padding: 0 calc(24px + max(0px, (100vw - var(--space-header) - var(--content-max)) / 2)); gap: 24px; }
.header-topbar__title { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-text-muted); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mini search */
.mini-search { position: relative; display: flex; align-items: center; width: min(280px, 26vw); flex-shrink: 0; }
.mini-search__icon { width: 18px; height: 18px; position: absolute; left: 12px; color: var(--color-text-muted); pointer-events: none; }
.mini-search__icon circle, .mini-search__icon path { fill: none; stroke: currentColor; stroke-width: 2; }
.mini-search__input { width: 100%; background: var(--color-white); border: 1px solid var(--color-line); border-radius: 999px; padding: 9px 38px 9px 38px; font-size: var(--text-sm); color: var(--color-text); transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out); appearance: none; }
.mini-search__input::placeholder { color: var(--color-text-muted); }
.mini-search__input:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(255,106,0,0.18); }
.mini-search__clear { position: absolute; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--color-line); color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--duration), color var(--duration); border: none; }
.mini-search__clear:hover { background: var(--color-accent); color: var(--color-white); }

/* Mobile nav control */
.nav-toggle { display: none; position: fixed; top: 14px; right: 16px; z-index: 130; flex-direction: column; gap: 5px; padding: 10px 12px; background: var(--color-primary); border-radius: var(--radius-element); border: 1px solid rgba(255,255,255,0.08); cursor: pointer; box-shadow: var(--shadow-card); }
.nav-toggle__bar { width: 20px; height: 2px; background: var(--color-accent-soft); border-radius: 2px; }
.nav-close { display: none; align-self: flex-end; width: 36px; height: 36px; margin-bottom: 16px; background: rgba(255,255,255,0.08); border-radius: 50%; cursor: pointer; position: relative; transition: background var(--duration); }
.nav-close__line { position: absolute; inset: 0; margin: auto; width: 16px; height: 2px; background: var(--color-white); border-radius: 2px; transform: rotate(45deg); }
.nav-close__line::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 2px; background: var(--color-white); border-radius: 2px; transform: rotate(90deg); }
.nav-close:hover { background: rgba(255,106,0,0.3); }

/* ===== Overlay nav mobile ===== */
@media (max-width: 960px) {
  .l-header { position: fixed; inset: 0 auto auto 0; width: 100%; height: 64px; background: var(--color-primary); border-bottom: none; display: block; }
  .header-side { padding: 0; overflow: visible; }
  .brand { margin: 0; padding: 12px 16px; height: 64px; }
  .brand__mark { width: 28px; height: 28px; }
  .brand__name { font-size: 1.125rem; }
  .brand__tagline { font-size: 0.625rem; }
  .site-nav { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); background: var(--color-primary-deep); padding: 28px 24px; z-index: 120; transform: translateX(105%); transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out); box-shadow: none; overflow-y: auto; }
  .site-nav[data-open] { transform: translateX(0); box-shadow: -20px 0 60px rgba(0,0,0,0.3); }
  .nav-close { display: flex; }
  .nav-list { gap: 2px; }
  .nav-link { padding: 14px 16px; }
  .nav-toggle { display: flex; }
  .header-side__foot { display: block; margin-top: 24px; padding: 16px; }
  .header-topbar { left: 0; height: 64px; padding: 0 72px 0 16px; background: var(--color-primary); border-bottom: none; justify-content: flex-start; }
  .header-topbar__title { color: rgba(255,255,255,0.85); font-size: 0.8125rem; }
  .mini-search { display: none; }
}

@media (max-width: 640px) {
  .header-topbar__title { max-width: calc(100vw - 110px); }
}

/* ===== Footer ===== */
.l-footer { background: var(--color-primary); color: var(--color-white); margin-left: var(--space-header); padding: 56px 24px 28px; }
.footer-inner { max-width: calc(var(--content-max) - var(--space-header)); margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.footer-brand { grid-column: span 1; }
.footer-brand__name { font-size: var(--text-xl); font-weight: 900; letter-spacing: 0.02em; }
.footer-brand__desc { margin-top: 10px; font-size: var(--text-sm); color: rgba(255,255,255,0.6); line-height: 1.6; }
.footer-trust { grid-column: span 2; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-card); padding: 16px 18px; }
.footer-trust__heading, .footer-links__heading, .footer-contact__heading { font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.02em; color: var(--color-accent-soft); margin-bottom: 10px; }
.footer-trust__text { font-size: var(--text-sm); color: rgba(255,255,255,0.72); line-height: 1.7; }
.footer-links__list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.footer-link { display: inline-block; font-size: var(--text-sm); color: rgba(255,255,255,0.65); padding: 4px 0; transition: color var(--duration) var(--ease-out); }
.footer-link:hover { color: var(--color-accent-soft); }
.footer-contact__item { font-size: var(--text-sm); color: rgba(255,255,255,0.6); line-height: 1.7; }
.footer-contact__item:first-of-type { margin-top: 4px; }
.footer-fineprint { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: var(--text-xs); color: rgba(255,255,255,0.4); }

@media (max-width: 960px) {
  .l-footer { margin-left: 0; padding: 40px 20px 24px; }
  .footer-inner { grid-template-columns: 1fr 1fr; max-width: 720px; margin: 0 auto; }
  .footer-trust { grid-column: span 2; grid-row: 3; }
  .footer-brand { grid-column: span 2; }
}

@media (max-width: 560px) {
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-trust { grid-column: span 1; }
  .footer-brand { grid-column: span 1; }
  .footer-fineprint { flex-direction: column; gap: 6px; }
}

/* ===== Main content area ===== */
#main-content { margin-left: var(--space-header); min-height: 60vh; padding-top: 64px; }
@media (max-width: 960px) { #main-content { margin-left: 0; } }

/* ===== Page heading & base containers ===== */
.page-head { padding: 56px 24px 24px; }
.page-head__inner { max-width: var(--content-max); margin: 0 auto; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.page-head__eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-size: var(--text-3xl); font-weight: 900; line-height: 1.15; color: var(--color-primary); }
.page-tagline { max-width: 480px; font-size: var(--text-sm); color: var(--color-text-muted); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--color-text-muted); }
.breadcrumb a { color: var(--color-secondary); font-weight: 500; }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb [aria-current="page"] { color: var(--color-text-muted); font-weight: 400; }
.breadcrumb__sep { color: var(--color-line); }
.breadcrumb-wrap { padding: 18px 24px 0; }
.breadcrumb-wrap .breadcrumb { max-width: var(--content-max); margin: 0 auto; }

/* ===== Generic layout grids ===== */
.layout-grid { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 960px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

/* ===== Card ===== */
.card { background: var(--color-bg-soft); border: 1px solid transparent; border-radius: var(--radius-card); padding: 22px; box-shadow: var(--shadow-card); transition: transform var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out); }
.card:hover { transform: translateY(-3px); border-color: var(--color-accent); box-shadow: var(--shadow-card-hover); }
.card__title { font-size: var(--text-lg); font-weight: 700; color: var(--color-primary); line-height: 1.35; margin-bottom: 8px; }
.card__desc { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.65; margin-bottom: 14px; }
.card__meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: 0.03em; }
.card__link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 700; color: var(--color-accent); transition: gap var(--duration) var(--ease-out); }
.card__link:hover { gap: 10px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 999px; font-size: var(--text-sm); font-weight: 700; cursor: pointer; transition: all var(--duration) var(--ease-out); }
.btn-primary { background: var(--color-accent); color: var(--color-white); box-shadow: 0 4px 14px rgba(255,106,0,0.35); }
.btn-primary:hover { background: #E85E00; box-shadow: 0 6px 22px rgba(255,106,0,0.45); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--color-primary); border: 2px solid var(--color-line); }
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ===== Tags ===== */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: rgba(27,59,111,0.08); color: var(--color-secondary); font-size: var(--text-xs); font-weight: 600; line-height: 1; }
.tag--orange { background: rgba(255,106,0,0.14); color: var(--color-accent); }

/* ===== Visual helpers ===== */
.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; }
.text-mono { font-family: var(--font-mono); }
.text-accent { color: var(--color-accent); }
.divider { height: 1px; background: var(--color-line); border: none; margin: 28px 0; }
.section-space { padding-top: 48px; }
.section-space--sm { padding-top: 28px; }

/* ===== Image container base (page phase uses these) ===== */
.figure { position: relative; border-radius: var(--radius-card); overflow: hidden; background: linear-gradient(145deg, var(--color-secondary), var(--color-primary)); aspect-ratio: 16/9; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
.figure__empty { color: rgba(255,255,255,0.45); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.1em; text-align: center; display: flex; align-items: center; justify-content: center; height: 100%; text-transform: uppercase; }
.figure__fake-bar { position: absolute; left: 24px; right: 24px; bottom: 20px; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.25); overflow: hidden; }
.figure__fake-bar--orange { position: absolute; top: 0; left: 0; bottom: 0; width: 36%; border-radius: inherit; background: var(--color-accent); }
.figure--screen { border: 1px solid rgba(255,255,255,0.08); }
.figure--panel { aspect-ratio: 4/3; background: linear-gradient(160deg, var(--color-secondary), var(--color-primary-deep)); }

/* ===== Reading rhythm helpers ===== */
.wide-chapter { width: 100%; }
.narrow-chapter { max-width: 720px; margin-left: auto; margin-right: auto; }

/* ===== Timeline (update log) ===== */
.timeline { display: grid; gap: 0; }
.timeline__item { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 20px; padding-bottom: 32px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ""; position: absolute; left: 94px; top: 22px; bottom: 0; width: 1px; background: var(--color-line); }
.timeline__item:last-child::before { display: none; }
.timeline__date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: 0.04em; padding-top: 4px; }
.timeline__date strong { display: block; font-size: var(--text-lg); color: var(--color-primary); }
.timeline__marker { position: relative; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 3px rgba(255,106,0,0.2); }
.timeline__content { padding-right: 8px; }
.timeline__content h3 { font-size: var(--text-md); font-weight: 700; color: var(--color-primary); margin-bottom: 4px; }
.timeline__content p { font-size: var(--text-sm); color: var(--color-text-muted); }
@media (max-width: 640px) {
  .timeline__item { grid-template-columns: 1fr; }
  .timeline__item::before { left: 4px; top: 38px; }
  .timeline__marker { left: 0; margin-bottom: 8px; }
}
