:root {
  --paper: #f5f4ef;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #66645f;
  --line: #d7d4cc;
  --soft: #ebe9e2;
  --strong: #252525;
  --max: 1280px;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); line-height: 1.65; }
a { color: inherit; text-underline-offset: 0.2em; }
button, input, select { font: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 30;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: white;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem max(1.25rem, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px);
}
.brand { font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.brand span { margin-left: 0.5rem; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; }
.site-header nav { display: flex; gap: 1rem; font-size: 0.9rem; }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }

main { width: min(var(--max), calc(100% - 2.5rem)); margin: 0 auto; }
.hero { padding: clamp(4rem, 10vw, 8rem) 0 3rem; border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.65fr); gap: 3rem; align-items: end; }
.kicker, .eyebrow { margin: 0 0 0.5rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
h1 { max-width: 920px; margin: 0; font-size: clamp(2.7rem, 7vw, 6.8rem); line-height: 0.98; letter-spacing: -0.07em; }
.hero .lede { max-width: 48rem; margin: 1.5rem 0 0; font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--muted); }
.hero-note { padding: 1.25rem; border: 1px solid var(--line); background: var(--surface); }

.section { padding: 4rem 0; border-bottom: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin-bottom: 2rem; }
.section-head h2 { margin: 0; font-size: clamp(1.9rem, 4vw, 3.6rem); letter-spacing: -0.05em; line-height: 1.05; }
.section-head p { max-width: 38rem; margin: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.metric { min-height: 150px; padding: 1.4rem; background: var(--surface); }
.metric strong { display: block; font-size: clamp(1.7rem, 3vw, 2.9rem); line-height: 1.1; letter-spacing: -0.05em; }
.metric p:last-child { margin-bottom: 0; color: var(--muted); font-size: 0.9rem; }

.controls { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto; gap: 0.75rem; margin-bottom: 1rem; }
.control { display: grid; gap: 0.3rem; }
.control label { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.control input, .control select {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}
.clear-button {
  align-self: end;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  cursor: pointer;
}
.result-line { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.88rem; }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.filter-card {
  scroll-margin-top: 6rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.filter-card[hidden] { display: none; }
.filter-card > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1.25rem;
  cursor: pointer;
  list-style: none;
}
.filter-card > summary::-webkit-details-marker { display: none; }
.filter-card > summary::after { content: "＋"; font-size: 1.4rem; }
.filter-card[open] > summary::after { content: "−"; }
.filter-card h3 { margin: 0 0 0.35rem; font-size: 1.35rem; letter-spacing: -0.03em; }
.card-subtitle { margin: 0; color: var(--muted); font-size: 0.9rem; }
.card-body { padding: 0 1.25rem 1.4rem; border-top: 1px solid var(--line); }
.card-body h4 { margin: 1.4rem 0 0.45rem; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.card-body p { margin: 0.35rem 0; }
.card-body dl { display: grid; grid-template-columns: 9rem 1fr; gap: 0.55rem 1rem; }
.card-body dt { color: var(--muted); }
.card-body dd { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.badge { display: inline-flex; align-items: center; padding: 0.24rem 0.55rem; border: 1px solid var(--line); background: var(--soft); font-size: 0.72rem; line-height: 1.2; }
.badge--dark { border-color: var(--strong); background: var(--strong); color: white; }
.badge--outline { background: transparent; }
.evidence-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; padding: 0; list-style: none; }
code { padding: 0.16rem 0.35rem; background: var(--soft); font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.72rem; }
.muted { color: var(--muted); }
.callout { padding: 1.25rem; border-left: 4px solid var(--ink); background: var(--soft); }

.lane-grid, .project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.lane, .project { padding: 1.2rem; border: 1px solid var(--line); background: var(--surface); }
.lane h3, .project h3 { margin-top: 0; }
.bar-list { display: grid; gap: 0.7rem; }
.bar-row { display: grid; grid-template-columns: minmax(130px, 0.7fr) 2fr auto; gap: 0.8rem; align-items: center; }
.bar-track { height: 12px; background: var(--soft); }
.bar-fill { height: 100%; min-width: 2px; background: var(--strong); }
.bar-value { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--soft); white-space: nowrap; }

.markdown-report { padding: 2rem; border: 1px solid var(--line); background: var(--surface); }
.markdown-report h1 { font-size: 2.5rem; letter-spacing: -0.04em; }
.markdown-report h2 { margin-top: 2.6rem; }
.markdown-report h3 { margin-top: 2rem; }
.markdown-report blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--muted); }
.markdown-report .table-wrap { margin: 1rem 0; }

.site-footer { width: min(var(--max), calc(100% - 2.5rem)); margin: 0 auto; padding: 2rem 0 4rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.82rem; }

:focus-visible { outline: 3px solid #777; outline-offset: 3px; }

@media (max-width: 900px) {
  .hero-grid, .card-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .controls { grid-template-columns: 1fr 1fr; }
  .control:first-child { grid-column: 1 / -1; }
  .lane-grid, .project-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .site-header { align-items: flex-start; }
  .brand span { display: block; margin: 0.1rem 0 0; }
  .site-header nav a:not(:last-child) { display: none; }
  main, .site-footer { width: min(100% - 1.25rem, var(--max)); }
  h1 { font-size: clamp(2.4rem, 15vw, 4rem); }
  html[data-site="matters"] h1 { font-size: 3rem; }
  .hero { padding-top: 3rem; }
  .section { padding: 3rem 0; }
  .section-head { display: block; }
  .section-head p { margin-top: 0.8rem; }
  .metrics, .controls, .lane-grid, .project-grid { grid-template-columns: 1fr; }
  .control:first-child { grid-column: auto; }
  .filter-card > summary { padding: 1rem; }
  .card-body { padding: 0 1rem 1rem; }
  .card-body dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .card-body dd { margin-bottom: 0.8rem; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .site-footer { display: block; }
}

@media print {
  .site-header, .controls, .clear-button, .skip-link { display: none !important; }
  :root, body { background: white; }
  main { width: 100%; }
  .filter-card { break-inside: avoid; }
  .filter-card > summary::after { display: none; }
  .card-body { display: block !important; }
}
