:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --surface-strong: #eef2f5;
  --text: #171a1d;
  --text-muted: #5e6873;
  --text-faint: #66717b;
  --border: #d8dee4;
  --border-strong: #b9c2cb;
  --blue: #1769aa;
  --blue-hover: #0f568e;
  --blue-soft: #eaf3fa;
  --green: #176b45;
  --green-soft: #e8f5ee;
  --gold: #8a5b00;
  --gold-soft: #fff3d6;
  --red: #a13a3a;
  --red-soft: #faecec;
  --focus: #1677c8;
  --radius: 6px;
  --control-height: 42px;
  --sticky-height: 58px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  max-width: 100%;
  min-height: var(--control-height);
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.25;
}

button {
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue-hover);
}

button:active:not(:disabled) {
  background: var(--surface-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

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

h1,
h2,
h3,
h4,
p,
dl,
dd,
ol {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shell {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 28px;
}

[hidden] {
  display: none !important;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "kicker stats"
    "title stats"
    "subtitle stats";
  column-gap: 48px;
  padding-block: 28px 26px;
}

.kicker {
  grid-area: kicker;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

.site-header h1 {
  grid-area: title;
  margin-bottom: 8px;
  font-size: 2rem;
  font-weight: 750;
}

.subtitle {
  grid-area: subtitle;
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.summary-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, auto));
  align-self: center;
  margin-bottom: 0;
}

.summary-stats > div {
  min-width: 0;
  padding: 4px 20px;
  border-left: 1px solid var(--border);
}

.summary-stats > div:last-child {
  padding-right: 0;
}

.summary-stats dt {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.summary-stats dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

main.shell {
  padding-bottom: 56px;
}

.view-switch {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  min-height: var(--sticky-height);
  margin-inline: -28px;
  padding: 8px 28px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.view-switch button {
  position: relative;
  height: 50px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 650;
}

.view-switch button::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 3px;
  background: transparent;
  content: "";
}

.view-switch button:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.view-switch button[aria-selected="true"] {
  color: var(--blue);
}

.view-switch button[aria-selected="true"]::after {
  background: var(--blue);
}

[role="tabpanel"] {
  min-width: 0;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding: 30px 0 20px;
}

.section-heading p {
  grid-column: 1;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.section-heading h2 {
  grid-column: 1;
  margin-bottom: 0;
  font-size: 1.5rem;
}

.stack-nav {
  position: sticky;
  top: var(--sticky-height);
  z-index: 15;
  display: flex;
  gap: 0;
  margin-inline: -28px;
  padding-inline: 28px;
  overflow-x: auto;
  border-block: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.stack-nav a {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.stack-nav a:first-child {
  border-left: 1px solid var(--border);
}

.stack-nav a:hover {
  background: var(--surface-strong);
  color: var(--blue);
}

.stack-nav a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

#business-stacks {
  border-top: 0;
}

.business-stack {
  min-width: 0;
  padding: 32px 0 34px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 116px;
}

.business-stack h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.stack-problem {
  max-width: 72rem;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.workflow-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 0;
  min-width: 0;
  margin: 0 0 20px;
  padding: 0 0 10px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.workflow-step {
  display: grid;
  grid-template-rows: auto minmax(3.2em, auto) auto 1fr;
  align-content: start;
  min-width: 0;
  min-height: 180px;
  padding: 4px 20px 14px;
  border-left: 1px solid var(--border);
}

.workflow-step:last-child {
  border-right: 1px solid var(--border);
}

.workflow-step-number {
  display: block;
  margin-bottom: 5px;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.workflow-step h4 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.fact-badge,
.tier-badge,
.mode-badge,
.business-area-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mode-badge {
  margin-bottom: 10px;
}

.tier-now {
  border-color: #9bc9b2;
  background: var(--green-soft);
  color: var(--green);
}

.tier-pilot {
  border-color: #ddc37f;
  background: var(--gold-soft);
  color: var(--gold);
}

.tier-watch {
  border-color: #d8aaaa;
  background: var(--red-soft);
  color: var(--red);
}

.workflow-projects {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.workflow-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.workflow-project .tier-badge {
  min-height: 21px;
  padding: 2px 5px;
  font-size: 0.65rem;
}

.workflow-track a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.missing-project {
  color: var(--red);
  font-size: 0.8rem;
}

.stack-note {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  max-width: 72rem;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.stack-note strong {
  color: var(--text);
}

.stack-note:last-child {
  margin-bottom: 0;
  color: var(--red);
}

#recommended-tools-title {
  margin: 36px 0 16px;
  font-size: 1.35rem;
  scroll-margin-top: 72px;
}

#recommendation-filters {
  display: grid;
  grid-template-columns: auto minmax(180px, 260px) auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-block: 1px solid var(--border);
  background: var(--surface-subtle);
}

.tier-filter-group {
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
}

.tier-filter {
  min-height: var(--control-height);
  padding: 0 12px;
  border-radius: 0;
  font-size: 0.84rem;
  white-space: nowrap;
}

.tier-filter + .tier-filter {
  margin-left: -1px;
}

.tier-filter:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.tier-filter:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.tier-filter[aria-pressed="true"] {
  z-index: 1;
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.tier-filter[data-tier="now"][aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.tier-filter[data-tier="pilot"][aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.tier-filter[data-tier="watch"][aria-pressed="true"] {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.filter-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.filter-field label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.25;
}

.filter-field input,
.filter-field select {
  width: 100%;
  padding: 8px 10px;
}

#recommendation-count,
#catalog-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

#recommendation-count {
  align-self: center;
  justify-self: end;
}

#recommendation-list,
#catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  align-items: stretch;
  gap: 16px;
  min-width: 0;
}

.recommendation-card,
.catalog-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(23 26 29 / 5%);
  overflow-wrap: anywhere;
}

.recommendation-card:hover,
.catalog-card:hover {
  border-color: var(--border-strong);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  margin-bottom: 12px;
}

.project-card-header > div {
  flex: 1 1 auto;
  min-width: 0;
}

.project-card-header h3 {
  margin-bottom: 3px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.project-card-header > .tier-badge {
  flex: 0 0 auto;
}

.project-avatar {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-strong);
  object-fit: cover;
}

.project-category {
  margin-bottom: 0;
  color: var(--text-faint);
  font-size: 0.76rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.project-summary {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.business-area-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.business-area-badge {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.project-facts {
  display: grid;
  grid-template-columns: minmax(76px, 98px) minmax(0, 1fr);
  gap: 0 12px;
  min-width: 0;
  margin-bottom: 15px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.project-facts dt,
.project-facts dd {
  min-width: 0;
  margin: 0;
  padding-block: 6px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.project-facts dt {
  color: var(--text-faint);
  font-weight: 600;
}

.project-facts dd {
  color: var(--text);
}

.recommendation-card .project-facts dt:nth-of-type(n + 7),
.recommendation-card .project-facts dd:nth-of-type(n + 7) {
  padding-block: 8px;
}

.recommendation-card .project-facts dt:nth-of-type(7),
.recommendation-card .project-facts dd:nth-of-type(7) {
  border-top: 2px solid var(--border-strong);
}

.repository-link {
  margin: auto 0 0;
  padding-top: 2px;
  font-size: 0.84rem;
  font-weight: 650;
}

.repository-link a {
  display: inline-block;
  padding-block: 4px;
}

#catalog-controls {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.8fr)
    repeat(5, minmax(120px, 1fr))
    minmax(110px, 0.8fr)
    auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border-block: 1px solid var(--border);
  background: var(--surface-subtle);
}

.reset-filters {
  min-width: 68px;
  padding: 8px 14px;
  border-color: var(--red);
  color: var(--red);
  font-weight: 650;
}

.reset-filters:hover:not(:disabled) {
  background: var(--red-soft);
  color: var(--red);
}

#catalog-count {
  margin-bottom: 14px;
  text-align: right;
}

.catalog-card {
  min-height: 292px;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 10px 0;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-faint);
  font-size: 0.76rem;
}

.site-footer .shell {
  padding-block: 20px;
}

@media (max-width: 1040px) {
  .site-header .shell {
    column-gap: 24px;
  }

  .summary-stats > div {
    padding-inline: 14px;
  }

  #catalog-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #catalog-controls .filter-field:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  :root {
    --sticky-height: 54px;
  }

  .shell {
    padding-inline: 18px;
  }

  .site-header .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "title"
      "subtitle"
      "stats";
    gap: 0;
    padding-block: 20px 18px;
  }

  .site-header h1 {
    margin-bottom: 5px;
    font-size: 1.65rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .summary-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .summary-stats > div {
    padding: 0 10px;
    border-left: 1px solid var(--border);
  }

  .summary-stats > div:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .summary-stats dd {
    font-size: 1rem;
  }

  .view-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: var(--sticky-height);
    margin-inline: -18px;
    padding: 5px 18px 0;
  }

  .view-switch button {
    height: 49px;
    min-height: 49px;
    padding-inline: 10px;
  }

  .section-heading {
    padding-block: 24px 16px;
  }

  .section-heading h2 {
    font-size: 1.3rem;
  }

  .stack-nav {
    margin-inline: -18px;
    padding-inline: 18px;
  }

  .business-stack {
    padding-block: 26px 28px;
    scroll-margin-top: 108px;
  }

  .workflow-step {
    grid-template-rows: auto minmax(2.8em, auto) auto 1fr;
    min-height: 170px;
    padding-inline: 16px;
  }

  .stack-note {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  #recommendation-filters {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
    gap: 12px;
    padding: 12px;
  }

  .tier-filter-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tier-filter {
    min-width: 0;
    padding-inline: 7px;
    white-space: normal;
  }

  #recommendation-count {
    justify-self: end;
  }

  #catalog-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  #catalog-controls .filter-field:first-child {
    grid-column: 1 / -1;
  }

  .reset-filters {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .shell {
    padding-inline: 14px;
  }

  .site-header .shell {
    padding-block: 16px 14px;
  }

  .site-header h1 {
    font-size: 1.45rem;
  }

  .kicker {
    font-size: 0.7rem;
  }

  .subtitle {
    font-size: 0.82rem;
  }

  .summary-stats {
    margin-top: 12px;
    padding-top: 10px;
  }

  .summary-stats > div {
    padding-inline: 7px;
  }

  .summary-stats dt {
    font-size: 0.68rem;
  }

  .summary-stats dd {
    font-size: 0.86rem;
  }

  .view-switch {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .stack-nav {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .stack-nav a {
    padding-inline: 13px;
  }

  .workflow-track {
    grid-auto-columns: minmax(210px, 82%);
  }

  #recommendation-filters {
    grid-template-columns: 1fr;
  }

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

  .tier-filter:nth-child(2) {
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .tier-filter:nth-child(3) {
    margin-top: -1px;
    margin-left: 0;
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .tier-filter:nth-child(4) {
    margin-top: -1px;
  }

  #recommendation-count {
    justify-self: start;
  }

  #catalog-controls {
    grid-template-columns: 1fr;
  }

  #catalog-controls .filter-field:first-child {
    grid-column: auto;
  }

  .recommendation-card,
  .catalog-card {
    padding: 15px;
  }

  .project-card-header {
    flex-wrap: wrap;
  }

  .project-card-header > .tier-badge {
    margin-left: 59px;
  }

  .catalog-card .project-card-header > .tier-badge {
    margin-left: 0;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141719;
    --surface: #1b1f22;
    --surface-subtle: #1e2327;
    --surface-strong: #272d31;
    --text: #f2f4f5;
    --text-muted: #b6c0c8;
    --text-faint: #929da7;
    --border: #353d43;
    --border-strong: #505b63;
    --blue: #70b8ed;
    --blue-hover: #9bcdf2;
    --blue-soft: #18364b;
    --green: #80d5aa;
    --green-soft: #173b2b;
    --gold: #e9c66f;
    --gold-soft: #423414;
    --red: #f09b9b;
    --red-soft: #472525;
    --focus: #79c5ff;
  }

  .tier-now {
    border-color: #326d50;
  }

  .tier-pilot {
    border-color: #80672b;
  }

  .tier-watch {
    border-color: #7d4545;
  }

  .recommendation-card,
  .catalog-card {
    box-shadow: none;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
