/* Agentic System Lab's homepage (index.html, zh/index.html, 404.html).
   The palette is the one the org's other pages use (Agent Loop Visualizer, Agent Atlas), so the sites read as one. */

:root {
  --bg: #f4f0e6;
  --surface: #fbf9f3;
  --sunk: #ebe5d6;
  --ink: #18212b;
  --ink-2: #414c58;
  --muted: #5f6772;
  --line: #d8d0bf;
  --accent: #b73d23;
  --link: #2f5191;
  /* The loop's parts, as Agent Loop Visualizer colors them. */
  --c-context: #3d5c9a;
  --c-model: #b73d23;
  --c-harness: #6b4c8a;
  --c-env: #286f60;
  --c-stop: #414c58;
  --sans: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --header-h: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181d;
    --surface: #1a1f26;
    --sunk: #252c36;
    --ink: #e8e3d8;
    --ink-2: #c4beb2;
    --muted: #9aa1aa;
    --line: #333a44;
    --accent: #e3795f;
    --link: #93b3f0;
    --c-context: #93b3f0;
    --c-model: #e3795f;
    --c-harness: #b9a0e0;
    --c-env: #6fbfa8;
    --c-stop: #c4beb2;
  }
}
:root[data-theme="dark"] {
  --bg: #14181d;
  --surface: #1a1f26;
  --sunk: #252c36;
  --ink: #e8e3d8;
  --ink-2: #c4beb2;
  --muted: #9aa1aa;
  --line: #333a44;
  --accent: #e3795f;
  --link: #93b3f0;
  --c-context: #93b3f0;
  --c-model: #e3795f;
  --c-harness: #b9a0e0;
  --c-env: #6fbfa8;
  --c-stop: #c4beb2;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: .2em; }
img { max-width: 100%; }
code { font: 500 .86em var(--mono); background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.skip:focus { top: 8px; }

/* Header: the org's mark and name, the page's sections, and the language switch. */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar {
  display: flex; align-items: center; gap: 16px;
  max-width: 1080px; height: var(--header-h); margin: 0 auto; padding: 0 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  color: var(--ink); font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap;
}
.brand img { flex: none; width: 30px; height: 30px; border-radius: 7px; background: #fff; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  padding: 5px 10px; border-radius: 6px;
  color: var(--ink-2); font-size: 15px; line-height: 1.4; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--sunk); }
.lang { display: flex; flex: none; font-size: 14px; line-height: 1; }
.lang a {
  padding: 7px 11px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.lang a:first-child { border-radius: 8px 0 0 8px; }
.lang a + a { margin-left: -1px; border-radius: 0 8px 8px 0; }
.lang a:hover { background: var(--sunk); }
.lang a[aria-current] {
  position: relative; border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Hero: what the lab does, and the loop every project opens up. */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: center;
  padding: 72px 0 56px;
}
.kicker { margin: 0 0 12px; font: 700 12.5px/1 var(--mono); letter-spacing: .14em; color: var(--accent); }
h1 { margin: 0; font-size: clamp(32px, 4.6vw, 46px); line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.intro { max-width: 600px; margin: 20px 0 0; font-size: 18px; line-height: 1.75; color: var(--ink-2); }
.meta { margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15.5px; font-weight: 600; line-height: 1.3; text-decoration: none;
}
.btn:hover { background: var(--sunk); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fbf9f3; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
:root[data-theme="dark"] .btn.primary { color: #14181d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #14181d; } }

.loop { margin: 0; }
.loop svg { display: block; width: 100%; height: auto; max-width: 480px; margin: 0 auto; }
.loop figcaption { margin: 10px auto 0; max-width: 420px; text-align: center; font-size: 14px; line-height: 1.6; color: var(--muted); }
.ring { fill: none; stroke: var(--line); stroke-width: 2; }
.arc { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.node rect { fill: var(--surface); stroke-width: 2; }
.node text { font: 600 15px var(--sans); text-anchor: middle; dominant-baseline: central; }
.node.context rect { stroke: var(--c-context); } .node.context text { fill: var(--c-context); }
.node.model rect { stroke: var(--c-model); } .node.model text { fill: var(--c-model); }
.node.harness rect { stroke: var(--c-harness); } .node.harness text { fill: var(--c-harness); }
.node.env rect { stroke: var(--c-env); } .node.env text { fill: var(--c-env); }
.node.stop rect { stroke: var(--c-stop); stroke-dasharray: 4 3; } .node.stop text { fill: var(--c-stop); }
.arc.context { stroke: var(--c-context); } .arc.model { stroke: var(--c-model); }
.arc.harness { stroke: var(--c-harness); } .arc.env { stroke: var(--c-env); }
.arc.stop { stroke: var(--c-stop); stroke-dasharray: 5 4; }
.hub { font: 600 12px var(--mono); letter-spacing: .08em; fill: var(--muted); text-anchor: middle; dominant-baseline: central; }

/* Sections */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section > h2 { margin: 0 0 8px; font-size: 28px; line-height: 1.3; }
.section > .lead { max-width: 720px; margin: 0 0 28px; color: var(--muted); }
.label { margin: 0 0 6px; font: 700 12px/1 var(--mono); letter-spacing: .12em; color: var(--muted); }

.project {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px; align-items: start;
  padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.project h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 23px; line-height: 1.3; }
.project h3 img { flex: none; width: 40px; height: 40px; }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { text-decoration: underline; }
.project p { margin: 0 0 14px; color: var(--ink-2); }
.links { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.links li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; line-height: 1.55; color: var(--muted); }
.links a { font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; }
.tags li { padding: 2px 9px; border-radius: 999px; background: var(--sunk); font: 500 12.5px/1.7 var(--mono); color: var(--ink-2); }
.shot { display: block; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--sunk); }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 1440 / 900; }
.shot:hover { border-color: var(--muted); }

.soon {
  display: flex; gap: 14px; align-items: flex-start; margin: 20px 0 0; padding: 18px 22px;
  border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-2);
}
.soon p { margin: 0; }
.soon .dot { flex: none; width: 10px; height: 10px; margin-top: 9px; border-radius: 50%; background: var(--c-env); }

.atlas {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 32px; align-items: center;
  padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.atlas + .atlas { margin-top: 20px; }  /* the talk notes and playbook cards under the study group's */
.atlas h3 { margin: 0 0 10px; font-size: 23px; line-height: 1.3; }
.atlas h3 a { color: var(--ink); text-decoration: none; }
.atlas h3 a:hover { text-decoration: underline; }
.atlas p { margin: 0 0 10px; color: var(--ink-2); }
.atlas p:last-child { margin-bottom: 0; }
.stats { display: flex; gap: 28px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; align-items: center; }  /* the number above its label */
.stats dt { font-size: 14px; color: var(--muted); }
.stats dd { margin: 0; font: 700 36px/1.1 var(--sans); color: var(--accent); }

.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.principles li { padding: 22px 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.principles .n { display: block; margin: 0 0 10px; font: 700 13px/1 var(--mono); color: var(--accent); }
.principles h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.35; }
.principles p { margin: 0; font-size: 16px; line-height: 1.7; color: var(--ink-2); }

.site-footer { border-top: 1px solid var(--line); }
.site-footer .bar { height: auto; padding-top: 22px; padding-bottom: 32px; flex-wrap: wrap; font-size: 14.5px; color: var(--muted); }
.site-footer a { color: var(--ink-2); }
.site-footer .end { margin-left: auto; display: flex; gap: 16px; }

/* Tablets */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 48px 0 40px; }
  .project { grid-template-columns: minmax(0, 1fr); }
  .project .shot { order: -1; }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .atlas { grid-template-columns: minmax(0, 1fr); }
  .stats { justify-content: flex-start; }
}
/* Phones: the section links give way to the language switch, and the side gutter narrows to 16px. */
@media (max-width: 640px) {
  .bar, main { padding-left: 16px; padding-right: 16px; }
  .nav { display: none; }
  .lang { margin-left: auto; }
  .hero { padding-top: 36px; }
  .intro { font-size: 17px; }
  .section { padding: 44px 0; }
  .section > h2 { font-size: 24px; }
  .project, .atlas { padding: 20px; }
  .site-footer .end { margin-left: 0; }
}
