:root {
  --bg: #f5f4ef;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --text: #1e252c;
  --muted: #69737d;
  --line: #dedbd2;
  --line-strong: #c9c3b7;
  --accent: #1f5f78;
  --accent-strong: #15485d;
  --green: #23725f;
  --amber: #9b6826;
  --rust: #a8472b;
  --code-bg: #151715;
  --code-text: #e9e4d6;
  --code-muted: #938c7d;
  --shadow: 0 20px 50px rgba(39, 45, 51, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(30, 37, 44, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 37, 44, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

pre,
code {
  font-family: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, monospace;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 28px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: none;
  transform: translateY(0);
  transition:
    width 260ms var(--ease),
    min-height 260ms var(--ease),
    padding 260ms var(--ease),
    border-color 260ms var(--ease),
    border-radius 260ms var(--ease),
    background-color 260ms var(--ease),
    box-shadow 260ms var(--ease),
    transform 260ms var(--ease);
}

.site-header.is-condensed {
  width: min(1120px, calc(100% - 44px));
  min-height: 64px;
  padding: 0 24px;
  border-color: color-mix(in srgb, var(--line-strong) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 18px 50px rgba(39, 45, 51, 0.14);
  transform: translateY(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  color: var(--text);
  font-weight: 780;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-toggle {
  display: none;
  position: relative;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 180ms var(--ease),
    color 180ms var(--ease);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-strong);
}

.nav-toggle span {
  position: absolute;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition:
    transform 180ms var(--ease),
    opacity 120ms ease;
}

.nav-toggle span:nth-child(1) {
  transform: translateY(-6px);
}

.nav-toggle span:nth-child(3) {
  transform: translateY(6px);
}

.site-header.is-menu-open .nav-toggle span:nth-child(1) {
  transform: rotate(45deg);
}

.site-header.is-menu-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.site-header.is-menu-open .nav-toggle span:nth-child(3) {
  transform: rotate(-45deg);
}

.section {
  width: min(1160px, calc(100% - 44px));
  margin: 0 auto;
  padding: clamp(64px, 9vw, 112px) 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: clamp(34px, 6vw, 76px);
  align-items: center;
  min-height: calc(100vh - 68px);
  padding-top: clamp(48px, 7vw, 92px);
  padding-bottom: clamp(40px, 7vw, 88px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(34px, 5.2vw, 64px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.2;
}

.hero-text,
.section-heading p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-weight: 760;
  text-decoration: none;
}

.button.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #f8faf8;
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--text);
}

.button.ghost {
  border-color: transparent;
  color: var(--muted);
}

.button:hover,
.button:focus-visible,
.copy-button:hover,
.copy-button:focus-visible,
.skill-tab:hover,
.install-tab:hover {
  transform: translateY(-1px);
}

.hero-preview {
  position: relative;
}

.hero-copy,
.hero-preview,
.runtime-grid > *,
.workflow-grid > *,
.install-panel > * {
  min-width: 0;
}

.hero-terminal,
.terminal-panel {
  overflow: hidden;
  border: 1px solid #2e332f;
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: var(--shadow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid #2a2e2a;
  color: var(--code-muted);
  font-size: 13px;
}

.terminal-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-bar span:nth-child(1) { background: #d95e48; }
.terminal-bar span:nth-child(2) { background: #d9a441; }
.terminal-bar span:nth-child(3) { background: #4d9f67; }

.terminal-bar strong {
  margin-left: 6px;
  font-weight: 680;
}

pre {
  margin: 0;
  max-width: 100%;
  white-space: pre;
}

.hero-terminal pre,
.terminal-panel pre {
  min-height: 310px;
  padding: 26px;
  color: var(--code-text);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: auto;
}

.section-heading {
  margin-bottom: 34px;
}

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

.skill-card {
  min-height: 216px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 88%, var(--bg));
}

.skill-card p {
  color: var(--muted);
}

.skill-card small {
  color: var(--accent);
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

.skill-kicker {
  display: block;
  margin-bottom: 18px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.rules-section {
  width: min(1180px, calc(100% - 44px));
}

.rules-grid {
  display: grid;
  grid-template-columns: 1.15fr repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.rule-card {
  min-height: 236px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 90%, var(--bg));
}

.rule-card-strong {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, white), var(--surface-strong) 52%),
    var(--surface-strong);
}

.rule-card span {
  display: block;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.rule-card h3 {
  overflow-wrap: anywhere;
}

.rule-card p {
  color: var(--muted);
}

.runtime-section {
  width: min(1220px, calc(100% - 44px));
}

.skill-tabs,
.install-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.skill-tab,
.install-tab,
.copy-button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 720;
  white-space: nowrap;
}

.skill-tab {
  --preview-progress-angle: 0turn;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(var(--line-strong), var(--line-strong)) border-box;
  border-color: transparent;
}

.skill-tab,
.install-tab {
  padding: 0 14px;
}

.skill-tab.is-active {
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--accent) 10%, var(--surface))) padding-box,
    linear-gradient(transparent, transparent) border-box;
  color: var(--accent-strong);
}

.skill-tab.is-active.is-auto-counting {
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--accent) 10%, var(--surface))) padding-box,
    conic-gradient(from -90deg, var(--accent) var(--preview-progress-angle), transparent 0) border-box;
}

.install-tab.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
}

.runtime-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.output-panel {
  min-height: 354px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.output-title {
  min-height: 42px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 800;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.output-panel pre {
  padding: 26px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  overflow-x: auto;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.output-panel.is-waiting .output-title,
.output-panel.is-waiting pre {
  opacity: 0;
  transform: translateY(6px);
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.2em;
  margin-left: 2px;
  transform: translateY(3px);
  background: #c98254;
  animation: blink 1s steps(2, start) infinite;
}

.output-cursor {
  display: none;
}

.output-panel.is-typing .output-cursor {
  display: inline-block;
}

@keyframes blink {
  50% { opacity: 0; }
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.workflow-path {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.workflow-path ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-path li {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.workflow-path li:last-child {
  border-bottom: 0;
}

.workflow-path span {
  color: var(--muted);
}

.workflow-diagram {
  margin: 24px 0 0;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 72%, white);
  border-radius: 12px;
  background: #fbfaf7;
  box-shadow: 0 24px 70px rgba(35, 42, 49, 0.08);
}

.workflow-map {
  position: relative;
  width: min(100%, 900px);
  height: clamp(1540px, 112vw, 1640px);
  margin: 0 auto;
  overflow: hidden;
}

.workflow-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.workflow-lines #flow-arrow path {
  fill: var(--accent);
}

.workflow-lines #feature-arrow path {
  fill: var(--accent-strong);
}

.workflow-lines #bug-arrow path {
  fill: var(--rust);
}

.flow-track {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 44%, white);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.feature-track {
  stroke: color-mix(in srgb, var(--accent-strong) 46%, white);
}

.bug-track {
  stroke: color-mix(in srgb, var(--rust) 48%, white);
}

.direct-track {
  stroke: color-mix(in srgb, var(--accent) 68%, white);
  stroke-width: 6.5;
  opacity: 1;
}

.flow-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9 14;
  marker-end: url("#flow-arrow");
  opacity: 0.95;
  filter:
    drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 34%, transparent))
    drop-shadow(0 1px 1px rgba(31, 95, 120, 0.12));
  animation: flow-pulse 1.1s linear infinite;
}

.direct-line {
  stroke-width: 4.4;
  stroke-dasharray: 18 8;
  opacity: 1;
}

.feature-line {
  stroke: var(--accent-strong);
  marker-end: url("#feature-arrow");
}

.bug-line {
  stroke: var(--rust);
  marker-end: url("#bug-arrow");
}

.workflow-node {
  position: absolute;
  z-index: 2;
  left: var(--left);
  top: var(--top);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: clamp(156px, 28%, 250px);
  min-height: 118px;
  padding: 18px;
  border: 1.5px solid var(--node-color, var(--accent));
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--node-color, var(--accent)) 12%, white), rgba(255, 255, 255, 0.94) 48%),
    var(--surface-strong);
  box-shadow:
    0 18px 42px color-mix(in srgb, var(--node-color, var(--accent)) 17%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.workflow-node.wide-node {
  width: clamp(190px, 34%, 330px);
}

.workflow-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.42), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--node-color, var(--accent)) 86%, white), var(--node-color, var(--accent)));
  color: white;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--node-color, var(--accent)) 28%, transparent),
    inset 0 -8px 16px rgba(0, 0, 0, 0.12);
}

.workflow-copy {
  display: grid;
  min-width: 0;
}

.workflow-node small {
  color: var(--node-color, var(--accent));
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workflow-node strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.08;
}

.workflow-desc {
  margin-top: 8px;
  color: color-mix(in srgb, var(--node-color, var(--accent)) 42%, var(--text));
  font-size: 13px;
  line-height: 1.3;
}

.workflow-tag {
  justify-self: start;
  max-width: 100%;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 6px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--node-color, var(--accent)) 88%, white), var(--node-color, var(--accent)));
  color: white;
  font-size: 12px;
  font-weight: 820;
  line-height: 1.2;
}

.start-node {
  --node-color: #0d5f77;
}

.route-node,
.spec-node {
  --node-color: #1465d9;
}

.decision-node {
  --node-color: #a46a16;
}

.plan-node,
.commit-node {
  --node-color: #16833a;
}

.build-node {
  --node-color: #202d45;
}

.fix-node,
.verify-node,
.patch-node {
  --node-color: #ef5b12;
}

.review-node {
  --node-color: #6733b8;
}

@keyframes flow-pulse {
  to { stroke-dashoffset: -38; }
}

.install-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.7fr);
  gap: 18px;
}

.command-card,
.install-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.command-header h3 {
  margin: 0;
}

.copy-button {
  padding: 0 12px;
}

.command-card pre {
  padding: 22px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
}

.install-notes {
  padding: 22px;
  color: var(--muted);
}

.faq-list {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

summary {
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 780;
}

details p {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  text-decoration: none;
}

@media (max-width: 980px) {
  .hero,
  .runtime-grid,
  .workflow-grid,
  .rules-grid,
  .install-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

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

@media (max-width: 680px) {
  .site-header {
    padding: 0 18px;
  }

  .site-header.is-condensed {
    width: calc(100% - 24px);
    min-height: 60px;
    padding: 0 16px;
    transform: translateY(8px);
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    right: 16px;
    z-index: 30;
    display: grid;
    gap: 4px;
    width: min(220px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 82%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
    box-shadow: 0 18px 46px rgba(39, 45, 51, 0.16);
    color: var(--text);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 170ms var(--ease),
      transform 170ms var(--ease),
      visibility 0s linear 170ms;
  }

  .site-header.is-menu-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .nav-links a {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--muted);
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    color: var(--text);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .section,
  .runtime-section,
  .rules-section {
    width: min(1160px, calc(100% - 32px));
    padding: 58px 0;
  }

  h1,
  .hero-text,
  .eyebrow,
  .install-notes {
    overflow-wrap: anywhere;
  }

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

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workflow-path li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .workflow-map {
    height: 1780px;
  }

  .workflow-diagram {
    padding: 16px 10px;
  }

  .workflow-node {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    width: 156px;
    min-height: 106px;
    padding: 11px;
  }

  .workflow-node.wide-node {
    width: 190px;
  }

  .workflow-icon {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .workflow-node strong {
    font-size: 14px;
  }

  .workflow-desc {
    margin-top: 5px;
    font-size: 11px;
  }

  .workflow-tag {
    display: none;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .flow-line {
    animation: none !important;
    stroke-dasharray: none;
  }
}
