:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --paper: #ffffff;
  --paper-alt: #f8f9f8;
  --ink: #18201d;
  --muted: #5f6b66;
  --line: #d8dedb;
  --line-strong: #b7c1bc;
  --accent: #b54135;
  --accent-soft: #f7e8e5;
  --accent-dark: #823128;
  --green: #27715c;
  --green-soft: #e3f0eb;
  --amber: #936319;
  --amber-soft: #f6eddc;
  --blue: #315f8b;
  --blue-soft: #e7eef5;
  --shadow: 0 14px 38px rgba(24, 32, 29, 0.08);
  --content: 1160px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans SC", sans-serif;
}

body[data-project="factor-factory"] {
  --accent: #1f7164;
  --accent-soft: #e1f0ec;
  --accent-dark: #155348;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.site-shell {
  width: min(var(--content), calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  min-height: 68px;
  gap: 24px;
}

.site-identity {
  display: inline-flex;
  width: fit-content;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.site-identity strong {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 800;
}

.site-identity span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.project-switcher {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-alt);
  padding: 3px;
}

.project-switcher a {
  position: relative;
  min-width: 112px;
  border-radius: 5px;
  padding: 7px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
  transition: background 150ms ease, color 150ms ease;
}

.project-switcher a:hover {
  color: var(--ink);
}

.project-switcher a[aria-current="page"] {
  background: var(--paper);
  box-shadow: 0 1px 4px rgba(24, 32, 29, 0.11);
  color: var(--accent-dark);
}

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: clamp(36px, 7vw, 90px);
  align-items: end;
  padding-block: 62px 42px;
}

.project-kicker,
.detail-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.project-title {
  margin: 0;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.98;
  font-weight: 850;
  letter-spacing: 0;
}

.project-lead {
  max-width: 700px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.project-facts {
  display: grid;
  border-top: 2px solid var(--ink);
}

.project-fact {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 16px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-block: 13px;
}

.project-fact strong {
  font-size: 21px;
  line-height: 1.1;
}

.project-fact span {
  color: var(--muted);
  font-size: 13px;
}

.archive-main {
  padding-bottom: 72px;
}

.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-top: 1px solid var(--line-strong);
  padding-block: 20px 16px;
}

.archive-heading {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.filter-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.filter-button:hover {
  border-color: var(--line);
  color: var(--ink);
}

.filter-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.archive-sections {
  display: grid;
  gap: 38px;
}

.archive-group[hidden] {
  display: none;
}

.group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin: 16px 0 12px;
}

.group-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 820;
}

.group-heading span {
  color: var(--muted);
  font-size: 12px;
}

.entry-list {
  display: grid;
  gap: 14px;
}

.entry-card {
  display: grid;
  grid-template-columns: minmax(260px, 34%) minmax(0, 1fr);
  min-height: 238px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.entry-card:hover,
.entry-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
}

.entry-preview {
  position: relative;
  min-height: 238px;
  border-right: 1px solid var(--line);
  overflow: hidden;
  background: #e9ecea;
}

.entry-preview img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: transform 260ms ease;
}

.entry-card:hover .entry-preview img {
  transform: scale(1.015);
}

.entry-preview-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: space-between;
  padding: 22px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.entry-preview-fallback span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.entry-preview-fallback strong {
  max-width: 290px;
  font-size: 26px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.entry-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  padding: 26px 28px;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  align-items: center;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.status[data-status="进行中"]::before {
  background: var(--amber);
}

.status[data-status="计划中"]::before {
  background: var(--blue);
}

.entry-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 810;
  overflow-wrap: anywhere;
}

.entry-description {
  max-width: 670px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.entry-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.entry-highlights span {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-alt);
  padding: 4px 7px;
  color: #48524e;
  font-size: 11px;
  font-weight: 690;
}

.entry-arrow {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.entry-card:hover .entry-arrow {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  color: var(--muted);
  font-size: 12px;
}

.footer-inner strong {
  color: var(--ink);
  font-weight: 760;
}

.detail-main {
  padding-block: 46px 84px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

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

.detail-hero {
  max-width: 930px;
  padding-bottom: 38px;
}

.detail-title {
  margin: 0;
  font-size: clamp(36px, 6vw, 62px);
  line-height: 1.08;
  font-weight: 840;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.detail-deck {
  max-width: 820px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 760px);
  gap: clamp(42px, 8vw, 96px);
  align-items: start;
  border-top: 1px solid var(--line-strong);
  padding-top: 34px;
}

.detail-toc {
  position: sticky;
  top: 102px;
}

.detail-toc strong {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.detail-toc nav {
  display: grid;
  border-left: 1px solid var(--line);
}

.detail-toc a {
  padding: 7px 0 7px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-toc a:hover {
  border-left: 2px solid var(--accent);
  margin-left: -1px;
  color: var(--ink);
}

.detail-article {
  min-width: 0;
}

.detail-section {
  scroll-margin-top: 100px;
  margin-bottom: 54px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h2 {
  margin: 0 0 17px;
  font-size: 25px;
  line-height: 1.3;
  font-weight: 820;
}

.detail-section h3 {
  margin: 26px 0 10px;
  font-size: 17px;
  line-height: 1.4;
}

.detail-section p {
  margin: 0 0 16px;
  color: #35403b;
  font-size: 15px;
}

.detail-section ul,
.detail-section ol {
  display: grid;
  gap: 9px;
  margin: 0 0 18px;
  padding-left: 21px;
  color: #35403b;
  font-size: 15px;
}

.detail-section li::marker {
  color: var(--accent);
  font-weight: 800;
}

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 16px 18px;
  color: var(--accent-dark);
  font-size: 14px;
  line-height: 1.65;
}

.callout strong {
  font-weight: 820;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.evidence-item {
  border-top: 3px solid var(--line-strong);
  background: var(--paper);
  padding: 17px;
}

.evidence-item[data-strength="strong"] {
  border-top-color: var(--green);
}

.evidence-item[data-strength="medium"] {
  border-top-color: var(--amber);
}

.evidence-item[data-strength="weak"] {
  border-top-color: var(--blue);
}

.evidence-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-item strong {
  display: block;
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.4;
}

.chart-frame,
.table-frame,
.diagram-frame {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.chart-head,
.diagram-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 780;
}

.chart-head span,
.diagram-head span {
  color: var(--muted);
  font-weight: 650;
}

.cost-chart {
  display: grid;
  gap: 15px;
  padding: 20px 18px;
}

.cost-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 74px;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  font-weight: 730;
}

.cost-track {
  height: 24px;
  background: #edf0ee;
}

.cost-bar {
  height: 100%;
  min-width: 4px;
  background: var(--ink);
}

.cost-row:nth-child(2) .cost-bar {
  background: var(--amber);
}

.cost-row:nth-child(3) .cost-bar {
  background: var(--green);
}

.cost-value {
  text-align: right;
}

.figure-note {
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 11px 16px;
  color: var(--muted);
  font-size: 11px;
}

.research-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.research-table th,
.research-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  vertical-align: top;
  text-align: left;
}

.research-table th {
  background: var(--paper-alt);
  color: var(--muted);
  font-weight: 800;
}

.research-table tr:last-child td {
  border-bottom: 0;
}

.research-table a {
  color: var(--accent-dark);
  font-weight: 720;
}

.architecture {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.architecture-row {
  display: grid;
  grid-template-columns: 52px 160px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 13px 14px;
}

.architecture-row:nth-child(2) {
  border-left-color: var(--amber);
}

.architecture-row:nth-child(3) {
  border-left-color: var(--blue);
}

.architecture-row:nth-child(4) {
  border-left-color: var(--green);
}

.architecture-row b {
  font-size: 12px;
}

.architecture-row strong {
  font-size: 13px;
}

.architecture-row span {
  color: var(--muted);
  font-size: 12px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 18px;
}

.flow-step {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 112px;
  border: 1px solid var(--line);
  background: var(--paper-alt);
  padding: 12px;
}

.flow-step:not(:last-child)::after {
  position: absolute;
  z-index: 2;
  top: 44px;
  right: -10px;
  color: var(--accent);
  font-size: 16px;
  content: "›";
}

.flow-step b {
  color: var(--accent-dark);
  font-size: 11px;
}

.flow-step strong {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.35;
}

.flow-step span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
  font-size: 13px;
  font-weight: 720;
}

.source-link span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.source-link:hover {
  color: var(--accent-dark);
}

.source-link:hover span {
  color: var(--accent-dark);
}

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

.matrix-cell {
  min-height: 126px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px;
}

.matrix-cell:nth-child(3n) {
  border-right: 0;
}

.matrix-cell:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.matrix-cell b {
  color: var(--accent-dark);
  font-size: 11px;
}

.matrix-cell strong {
  display: block;
  margin-top: 7px;
  font-size: 13px;
}

.matrix-cell span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.empty-note {
  border: 1px dashed var(--line-strong);
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.slide-return {
  position: fixed;
  z-index: 9999;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(24, 32, 29, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  padding: 7px 10px;
  box-shadow: 0 5px 18px rgba(24, 32, 29, 0.12);
  color: #18201d;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 760;
}

.slide-return:hover {
  background: #18201d;
  color: #ffffff;
}

@media (max-width: 920px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .project-switcher {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    margin-bottom: 10px;
  }

  .project-hero {
    grid-template-columns: 1fr;
    gap: 34px;
  }

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

  .project-fact {
    grid-template-columns: 1fr;
    gap: 6px;
    border-right: 1px solid var(--line);
    padding: 14px;
  }

  .project-fact:last-child {
    border-right: 0;
  }

  .entry-card {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .entry-content {
    gap: 18px;
    padding: 22px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .detail-toc {
    position: static;
  }

  .detail-toc nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: 0;
    gap: 2px 10px;
  }

  .detail-toc a {
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .site-shell {
    width: min(var(--content), calc(100% - 28px));
  }

  .header-inner {
    min-height: 60px;
    gap: 8px 12px;
  }

  .site-identity span {
    display: none;
  }

  .project-switcher {
    width: 100%;
  }

  .project-switcher a {
    flex: 1;
    min-width: 0;
  }

  .project-hero {
    padding-block: 42px 34px;
  }

  .project-title {
    font-size: 44px;
  }

  .project-lead {
    font-size: 15px;
  }

  .project-facts {
    grid-template-columns: 1fr;
  }

  .project-fact {
    grid-template-columns: 68px 1fr;
    border-right: 0;
    padding-inline: 0;
  }

  .archive-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-list {
    width: 100%;
    justify-content: flex-start;
  }

  .entry-card {
    grid-template-columns: 1fr;
  }

  .entry-preview {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    aspect-ratio: 16 / 9;
  }

  .entry-content {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    padding: 20px;
  }

  .entry-title {
    font-size: 19px;
  }

  .entry-description {
    font-size: 13px;
  }

  .entry-highlights {
    display: none;
  }

  .entry-arrow {
    width: 38px;
    height: 38px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 18px;
  }

  .detail-main {
    padding-block: 30px 64px;
  }

  .breadcrumb {
    margin-bottom: 28px;
  }

  .detail-title {
    font-size: 36px;
  }

  .detail-deck {
    font-size: 15px;
  }

  .detail-toc nav {
    grid-template-columns: 1fr;
  }

  .evidence-grid,
  .matrix {
    grid-template-columns: 1fr;
  }

  .matrix-cell,
  .matrix-cell:nth-child(3n),
  .matrix-cell:nth-last-child(-n + 3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .matrix-cell:last-child {
    border-bottom: 0;
  }

  .cost-row {
    grid-template-columns: 86px minmax(0, 1fr) 62px;
    gap: 8px;
  }

  .architecture-row {
    grid-template-columns: 42px 1fr;
  }

  .architecture-row span {
    grid-column: 1 / -1;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .flow-step {
    min-height: auto;
  }

  .flow-step:not(:last-child)::after {
    top: auto;
    right: 16px;
    bottom: -16px;
    transform: rotate(90deg);
  }

  .research-table {
    min-width: 650px;
  }

  .table-frame {
    overflow-x: auto;
  }

  .slide-return {
    top: 8px;
    left: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
