/* Kuroshio design system — shared byte-for-byte by docs/ and the generated site.
   Ink is the current's own indigo; the thermal scale (cold → teal → warm) encodes strength. */
:root {
  --bg: #eef2f5; --panel: #ffffff; --panel-2: #f4f7f9; --line: #d6dee6; --line-2: #c3cfda;
  --fg: #0c1b2c; --muted: #50637a; --accent: #0b7a70; --accent-soft: #dcf1ee;
  --warn: #a8570a; --warn-soft: #fcefdc; --buy: #0b7a70; --sell: #b3322e;
  --t-cold: #2f5fb3; --t-warm: #e0851f;
  --glow: rgba(11, 122, 112, .08);
  --shadow: 0 1px 2px rgba(12, 27, 44, .05), 0 8px 24px -12px rgba(12, 27, 44, .12);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --r: 12px; --r-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07121f; --panel: #0c1a2b; --panel-2: #102236; --line: #1b3048; --line-2: #26405c;
    --fg: #e6edf5; --muted: #8b9fb6; --accent: #5eead4; --accent-soft: rgba(94, 234, 212, .1);
    --warn: #f2a54a; --warn-soft: rgba(242, 165, 74, .1); --buy: #5eead4; --sell: #f28b82;
    --t-cold: #4c7fe0; --t-warm: #f5a54a;
    --glow: rgba(94, 234, 212, .07);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  /* short pages: the footer still reaches the bottom of the window */
  min-height: 100vh; display: flex; flex-direction: column;
}
body > * { flex-shrink: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--bg); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 520px) { .wrap { padding: 0 16px; } }
code, .mono { font-family: var(--mono); font-size: .9em; }
p code, .sec-head code { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand span { color: var(--muted); font-weight: 500; font-size: 14px; letter-spacing: .08em; }
header nav { margin-left: auto; display: flex; gap: 4px; font-size: 14.5px; overflow-x: auto; scrollbar-width: none; }
header nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 7px; white-space: nowrap; }
header nav a:hover { color: var(--fg); background: var(--panel-2); }
@media (max-width: 520px) { .brand span { display: none; } header nav { font-size: 14px; } }

/* ---- hero ---- */
.hero { position: relative; padding: 88px 0 56px; }
.hero h1 {
  font-size: clamp(38px, 6.4vw, 72px); line-height: 1.02; margin: 0 0 22px;
  letter-spacing: -.035em; font-weight: 800; max-width: 14ch; text-wrap: balance;
}
.hero .lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 58ch; margin: 0 0 28px; text-wrap: pretty; }
.hero .lede strong { color: var(--fg); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.badge {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel);
}
.badge.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
pre.install {
  position: relative; background: var(--fg); color: var(--bg); border-radius: var(--r);
  padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.75;
  margin: 0 0 24px; max-width: 760px; box-shadow: var(--shadow);
}
pre.install .c { opacity: .55; }
pre.install .p { color: var(--accent); user-select: none; }
@media (prefers-color-scheme: dark) { pre.install { background: #030a13; color: var(--fg); border: 1px solid var(--line); } }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px;
  text-decoration: none; font-size: 15px; font-weight: 600; border: 1px solid var(--line-2);
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.ghost { color: var(--fg); background: var(--panel); }
.btn.ghost:hover { border-color: var(--accent); }

/* the current: isotherm lines behind the hero, drawn once on load */
.current { position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; pointer-events: none; overflow: hidden; }
.current svg { position: absolute; right: -4%; top: 0; width: min(1100px, 92vw); height: 100%; }
.current path { fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: flow 2.6s cubic-bezier(.3, .7, .2, 1) forwards; }
.current path:nth-child(2) { animation-delay: .12s; } .current path:nth-child(3) { animation-delay: .24s; }
.current path:nth-child(4) { animation-delay: .36s; } .current path:nth-child(5) { animation-delay: .48s; }
.current path:nth-child(6) { animation-delay: .6s; } .current path:nth-child(7) { animation-delay: .72s; }
@keyframes flow { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .current path { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 760px) { .current { opacity: .45; } }

/* ---- pillars: the pipeline, in order ---- */
.pillars {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0 0 72px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  box-shadow: var(--shadow); overflow: hidden;
}
.pillar { padding: 24px 24px 26px; border-right: 1px solid var(--line); position: relative; }
.pillar:last-child { border-right: 0; }
@media (max-width: 760px) { .pillar { border-right: 0; border-bottom: 1px solid var(--line); } .pillar:last-child { border-bottom: 0; } }
.pillar h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.pillar h3 em {
  font-style: normal; font-family: var(--mono); font-size: 12px; font-weight: 500;
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--accent);
}
.pillar p { margin: 0; font-size: 15px; color: var(--muted); }
.pillar code { font-size: 13px; color: var(--fg); }

/* ---- sections ---- */
section { padding: 80px 0; border-top: 1px solid var(--line); }
.sec-head { margin-bottom: 28px; }
.sec-head .kicker { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.sec-head h2 { margin: 0 0 10px; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.12; letter-spacing: -.025em; font-weight: 750; text-wrap: balance; }
.sec-head p { margin: 0; color: var(--muted); max-width: 70ch; font-size: 16px; text-wrap: pretty; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.chip {
  font: 500 13px var(--sans); padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
button.chip:hover { color: var(--fg); border-color: var(--line-2); }
.chip[aria-pressed="true"] { color: var(--bg); border-color: var(--fg); background: var(--fg); }
.chip.tab { font-weight: 650; min-width: 52px; }
.spacer { flex: 1 1 auto; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tablebox { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th:nth-child(-n+2), td:nth-child(-n+2) { text-align: left; }
th {
  position: sticky; top: 0; background: var(--panel); color: var(--muted); cursor: pointer;
  font: 600 12.5px var(--sans); user-select: none; border-bottom-color: var(--line-2);
}
th:hover { color: var(--fg); }
th .arrow { color: var(--accent); font-size: 10px; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--panel-2); }
td.tk { font-weight: 700; color: var(--fg); }
td:first-child { color: var(--muted); }
.bar { position: relative; min-width: 150px; }
.bar i {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%); height: 6px; max-width: calc(100% - 16px);
  border-radius: 3px; display: block; opacity: .9;
  background: color-mix(in oklch decreasing hue, var(--t-cold), var(--t-warm) calc(var(--s, .5) * 100%));
}
.bar span { position: relative; display: inline-block; padding-left: 4px; background: var(--panel); border-radius: 3px; }
tbody tr:hover .bar span { background: var(--panel-2); }
td.bar { text-align: right; }
.flag { font: 500 11.5px var(--sans); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.flag.hi { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.flag.wa { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.note { padding: 14px 16px; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel-2); }

/* ---- propose ---- */
.two > div > .panel + .panel { margin-top: 20px; }
.two { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }
.panel h4 { margin: 0; padding: 14px 16px 10px; font-size: 14px; font-weight: 700; letter-spacing: -.005em; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 16px; font-size: 14px; border-top: 1px solid var(--line); }
.kv span:last-child { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.kv:last-child { padding-bottom: 12px; }
.kv span:first-child { color: var(--muted); }
.hold { display: grid; grid-template-columns: 1fr 56px 56px; gap: 10px; padding: 7px 16px; font-family: var(--mono); font-size: 13px; align-items: baseline; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hold > span:not(:first-child) { text-align: right; }
.hold .th { color: var(--muted); font: 600 12px var(--sans); }
.hold.over { color: var(--warn); background: var(--warn-soft); }
.cards { display: grid; gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px 16px 22px;
  position: relative; box-shadow: var(--shadow); overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--muted); opacity: .5; }
.card.SWAP::before { background: var(--buy); opacity: 1; }
.card.TRIM::before { background: var(--warn); opacity: 1; }
.card .act { font-family: var(--mono); font-size: 14px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.SWAP .act { color: var(--buy); }
.card.TRIM .act { color: var(--warn); }
.card.ALERT .act { color: var(--muted); }
.card .act .sell { color: var(--sell); }
.card p { margin: 0 0 12px; font-size: 15px; line-height: 1.55; }
.card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card li { padding: 2px 8px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); }

/* ---- backtest ---- */
/* flex, not grid: a short last row stretches instead of leaving empty cells */
.stats { display: flex; flex-wrap: wrap; }
.stat { flex: 1 1 180px; padding: 22px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stat b { display: block; font-family: var(--mono); font-size: clamp(24px, 2.6vw, 30px); font-weight: 600; letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13.5px; color: var(--muted); }
.quints { display: flex; align-items: flex-end; gap: 14px; height: 240px; padding: 24px 20px 0; }
.quint { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; height: 100%; }
.quint .v { font-family: var(--mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quint .col {
  width: 100%; border-radius: 6px 6px 0 0; min-height: 3px;
  background: color-mix(in oklch decreasing hue, var(--t-cold), var(--t-warm) calc(var(--s, .5) * 100%));
}
.quint .lb { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-bottom: 14px; }

/* ---- architecture ---- */
.arch { padding: 16px 12px; overflow-x: auto; }
.arch svg { display: block; min-width: 660px; width: 100%; height: auto; }
.arch .bx { fill: var(--panel-2); stroke: var(--line-2); }
.arch .bx.hl { stroke: var(--accent); fill: var(--accent-soft); stroke-width: 1.5; }
.arch .tl { fill: var(--fg); font: 700 14px var(--sans); }
.arch .sb { fill: var(--muted); font: 11.5px var(--mono); }
.arch .ln { stroke: var(--muted); stroke-width: 1.4; fill: none; opacity: .75; }

footer { margin-top: auto; border-top: 1px solid var(--line); padding: 40px 0 64px; color: var(--muted); font-size: 14px; background: var(--panel-2); }
footer p { margin: 0 0 10px; max-width: 80ch; }
.disc { font-size: 13px; opacity: .85; }
