:root {
  --paper: #f3ecd8;
  --ink: #15130f;
  --muted: #6b6254;
  --line: #2a261f;
  --terminal: #10160f;
  --terminal-soft: #1a2519;
  --glow: #b9ff6a;
  --added: #8cff8a;
  --removed: #ff684f;
  --accent: #d4492e;
  --cyan: #45d6c7;
  --card: rgba(255, 250, 232, 0.72);
  --shadow: 0 24px 80px rgba(21, 19, 15, 0.18);
  --mono: "IBM Plex Mono", "SFMono-Regular", "Cascadia Code", monospace;
  --display-zh: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --text-zh: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(212, 73, 46, 0.2), transparent 24rem),
    radial-gradient(circle at 88% 14%, rgba(69, 214, 199, 0.24), transparent 20rem),
    radial-gradient(circle at 70% 76%, rgba(185, 255, 106, 0.14), transparent 22rem),
    linear-gradient(135deg, #f7f0dc 0%, var(--paper) 48%, #ded1b7 100%);
  font-family: var(--mono), var(--text-zh);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 19, 15, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 19, 15, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 84%);
}

.grain,
.era-line {
  position: fixed;
  inset: 0;
  width: 100dvw;
  pointer-events: none;
}

.grain {
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.era-line {
  opacity: 0.32;
  background: linear-gradient(105deg, transparent 0 48%, rgba(212, 73, 46, 0.38) 48% 49%, rgba(185, 255, 106, 0.36) 49% 50%, transparent 50% 100%);
}

.site-header,
.section-shell,
.footer {
  width: min(1120px, calc(100vw - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 12px;
  position: relative;
  z-index: 2;
}

.brand,
.nav a,
.button,
.footer a { color: inherit; text-decoration: none; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--glow);
  background: var(--terminal);
  border: 1px solid var(--line);
  box-shadow: 5px 5px 0 var(--accent);
}

.nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(21, 19, 15, 0.18);
  background: rgba(255, 250, 232, 0.54);
  backdrop-filter: blur(12px);
}
.nav a {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 13px;
}
.nav a:hover { color: var(--ink); background: rgba(21, 19, 15, 0.06); }

.section-shell {
  position: relative;
  z-index: 1;
  margin-top: 74px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 42px;
  align-items: center;
  min-height: 72vh;
  margin-top: 24px;
}

.hero > *,
.era-panels > *,
.relation-grid > *,
.system > *,
.contact > * { min-width: 0; }

.eyebrow,
.section-kicker {
  margin: 0 0 14px;
  color: #7e2116;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
.hero-title {
  margin-bottom: 24px;
  font-family: var(--display-zh);
  font-size: clamp(58px, 7.8vw, 112px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 900;
}
.hero-title .title-line {
  display: flex;
  align-items: baseline;
  gap: 0.2em;
  white-space: nowrap;
}
.hero-title .now-line {
  margin-left: clamp(22px, 5vw, 76px);
}
.hero-title em {
  display: inline-grid;
  place-items: center;
  min-width: 2.7em;
  padding: 0.08em 0.16em 0.12em;
  border: 1px solid rgba(21, 19, 15, 0.34);
  background: rgba(255, 250, 232, 0.58);
  color: #7e2116;
  font-family: var(--mono), var(--text-zh);
  font-size: 0.28em;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  transform: translateY(-0.2em);
}
.hero-title strong {
  font-weight: 900;
}
h2 {
  max-width: 820px;
  font-family: var(--display-zh);
  font-size: clamp(40px, 6vw, 82px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 900;
  line-break: strict;
  overflow-wrap: break-word;
  text-wrap: balance;
  word-break: normal;
}
h3 {
  font-family: var(--display-zh);
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.018em;
  line-break: strict;
  overflow-wrap: break-word;
  word-break: normal;
}

.hero-subtitle {
  margin: -8px 0 18px;
  color: #7e2116;
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.hero-lede,
.section-note,
.contact p {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.button:hover { transform: translate(-2px, -2px); }
.button.primary {
  color: #fff8e5;
  background: var(--accent);
  box-shadow: 6px 6px 0 var(--line);
}
.button.ghost {
  background: rgba(255, 250, 232, 0.64);
  box-shadow: 6px 6px 0 rgba(21, 19, 15, 0.18);
}

.diff-card,
.contact {
  border: 1px solid #1f2a1d;
  background: linear-gradient(145deg, var(--terminal), var(--terminal-soft));
  color: #e8ffd3;
  box-shadow: var(--shadow), 12px 12px 0 var(--accent);
  overflow: hidden;
}
.diff-card { transform: rotate(1.2deg); }
.terminal-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(185, 255, 106, 0.22);
}
.terminal-topbar span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--removed);
}
.terminal-topbar span:nth-child(2) { background: #e5b84c; }
.terminal-topbar span:nth-child(3) { background: var(--added); }
.terminal-topbar strong {
  margin-left: auto;
  color: rgba(232, 255, 211, 0.7);
  font-size: 12px;
  white-space: nowrap;
}
.diff-body {
  position: relative;
  padding: 30px 26px 34px;
  min-height: 360px;
}
.diff-line {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(232, 255, 211, 0.14);
  background: rgba(255, 255, 255, 0.035);
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.4;
}
.diff-line span { font-weight: 600; }
.diff-line.removed { color: #ffc3b7; background: rgba(255, 104, 79, 0.09); text-decoration: line-through; text-decoration-thickness: 2px; }
.diff-line.kept { color: rgba(232, 255, 211, 0.72); }
.diff-line.added { color: var(--added); background: rgba(140, 255, 138, 0.09); }

.agent-constellation {
  position: absolute;
  inset: 140px 28px 18px;
  border: 1px dashed rgba(185, 255, 106, 0.24);
  background:
    linear-gradient(30deg, transparent 0 49%, rgba(69, 214, 199, 0.2) 49% 50%, transparent 50% 100%),
    linear-gradient(150deg, transparent 0 49%, rgba(185, 255, 106, 0.16) 49% 50%, transparent 50% 100%);
}
.agent-constellation i {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--glow);
  box-shadow: 0 0 22px rgba(185, 255, 106, 0.86);
  animation: pulse 2.4s ease-in-out infinite;
}
.agent-constellation i:nth-child(1) { left: 10%; top: 14%; }
.agent-constellation i:nth-child(2) { left: 76%; top: 20%; animation-delay: 0.2s; background: var(--cyan); }
.agent-constellation i:nth-child(3) { left: 44%; top: 48%; animation-delay: 0.4s; }
.agent-constellation i:nth-child(4) { left: 18%; top: 78%; animation-delay: 0.6s; background: var(--cyan); }
.agent-constellation i:nth-child(5) { left: 86%; top: 80%; animation-delay: 0.8s; }

.era-panels,
.relation-grid,
.system {
  display: grid;
  gap: 18px;
}
.era-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.era-card,
.relation-grid article,
.loop-node {
  border: 1px solid rgba(21, 19, 15, 0.24);
  background: var(--card);
  box-shadow: 8px 8px 0 rgba(21, 19, 15, 0.08);
  backdrop-filter: blur(14px);
}
.era-card {
  min-height: 430px;
  padding: 28px;
}
.before-card { box-shadow: 8px 8px 0 rgba(212, 73, 46, 0.22); }
.now-card { box-shadow: 8px 8px 0 rgba(69, 214, 199, 0.24); }
.era-card ul {
  display: grid;
  gap: 14px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.era-card li {
  display: grid;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(21, 19, 15, 0.18);
}
.era-card strong { color: #7e2116; }
.era-card span,
.relation-grid p,
.loop-node span { color: var(--muted); line-height: 1.72; }

.relation {
  display: grid;
  gap: 30px;
}
.relation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.relation-grid article {
  min-height: 280px;
  padding: 24px;
}
.relation-grid span {
  display: inline-block;
  margin-bottom: 70px;
  color: #7e2116;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.system {
  grid-template-columns: 0.82fr 1.18fr;
  align-items: center;
}
.loop-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, minmax(92px, auto));
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(21, 19, 15, 0.24);
  background: rgba(255, 250, 232, 0.46);
}
.loop-node {
  display: grid;
  align-content: space-between;
  min-height: 112px;
  padding: 18px;
}
.loop-node strong { font-family: var(--display-zh); font-size: 26px; letter-spacing: -0.04em; }
.loop-node.goal { grid-column: 1 / 4; grid-row: 1 / 2; }
.loop-node.context { grid-column: 4 / 7; grid-row: 1 / 3; background: rgba(69, 214, 199, 0.16); }
.loop-node.tools { grid-column: 1 / 5; grid-row: 2 / 4; background: rgba(16, 22, 15, 0.92); color: #e8ffd3; }
.loop-node.tools span { color: rgba(232, 255, 211, 0.72); }
.loop-node.eval { grid-column: 5 / 7; grid-row: 3 / 4; }
.loop-node.deploy { grid-column: 2 / 7; grid-row: 4 / 5; background: rgba(185, 255, 106, 0.18); }

.contact {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 70px;
  padding: 34px;
}
.contact p { color: rgba(255, 248, 229, 0.72); }
.contact .section-kicker { color: var(--glow); }
.contact h2 { color: #fff8e5; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 36px;
  color: var(--muted);
  font-size: 12px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.55); opacity: 1; }
}

@media (max-width: 980px) {
  .hero,
  .era-panels,
  .system,
  .contact { grid-template-columns: 1fr; }
  .diff-card { transform: none; }
  .era-card { min-height: auto; }
}

@media (max-width: 760px) {
  .site-header,
  .footer { align-items: flex-start; flex-direction: column; }
  .nav { width: 100%; overflow-x: auto; }
  .section-shell { width: min(100vw - 28px, 1120px); margin-top: 54px; }
  .hero { min-height: auto; gap: 28px; }
  .hero-title {
    font-size: clamp(48px, 14.8vw, 64px);
    line-height: 1.08;
    letter-spacing: -0.035em;
  }
  .hero-title .title-line {
    gap: 0.16em;
  }
  .hero-title .now-line {
    margin-left: 0;
  }
  .hero-title em {
    min-width: 2.5em;
    font-size: 0.25em;
    letter-spacing: 0.1em;
    text-indent: 0.1em;
    transform: translateY(-0.18em);
  }
  h2 { font-size: clamp(38px, 13vw, 58px); }
  .button { width: 100%; }
  .terminal-topbar strong { max-width: 58%; overflow: hidden; text-overflow: ellipsis; }
  .diff-card,
  .contact { box-shadow: var(--shadow), 8px 8px 0 var(--accent); }
  .diff-body { padding: 22px; min-height: 330px; }
  .diff-line { font-size: 15px; padding: 12px; }
  .agent-constellation { inset: 154px 22px 18px; }
  .relation-grid { grid-template-columns: 1fr; }
  .relation-grid article { min-height: 230px; }
  .relation-grid span { margin-bottom: 46px; }
  .loop-map { grid-template-columns: 1fr; grid-template-rows: none; }
  .loop-node.goal,
  .loop-node.context,
  .loop-node.tools,
  .loop-node.eval,
  .loop-node.deploy { grid-column: auto; grid-row: auto; }
  .contact { padding: 24px; }
}

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