
:root {
  --bg: #fafaf8; --panel: #ffffff;
  --ink: #17181a; --muted: #55575c; --faint: #9a9c9f; --line: #e4e4e0;
  --primary: #2f6152; --primary-soft: #ecf3f0; --primary-line: #c9dcd4;
  --head: "Satoshi", -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  --body: "General Sans", -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html[data-lang="en"] .lang-zh { display: none !important; }
html[data-lang="zh"] .lang-en { display: none !important; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 15.5px;
  -webkit-font-smoothing: antialiased; line-height: 1.65;
}
html[data-lang="zh"] body { line-height: 1.8; }
html[data-lang="zh"] h1 { letter-spacing: 0.01em; }

.lang {
  position: fixed; top: 1.4rem; right: 1.5rem; z-index: 20;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 0.78rem; font-weight: 500;
  padding: 0.3rem 0.8rem; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.lang:hover { border-color: var(--ink); color: var(--ink); }

main { max-width: 64rem; margin: 3.6rem auto 0; padding: 2.2rem 1.5rem 4.5rem; }

.crumb { font-size: 0.86rem; color: var(--faint); font-weight: 500; }
.crumb a { color: var(--primary); font-weight: 600; text-decoration: none; }
h1 {
  font-family: var(--head); font-weight: 700;
  font-size: clamp(2.1rem, 5.4vw, 3.1rem);
  line-height: 1.08; letter-spacing: -0.025em; margin-top: 1.1rem;
}
.loc { margin-top: 0.7rem; font-size: 1.1rem; font-weight: 500; color: var(--muted); }
.subtitle { margin-top: 1.1rem; font-size: 1.02rem; color: var(--muted); max-width: 38rem; }
.subtitle p { color: var(--muted); }
.subtitle p + p { margin-top: 0.8rem; }
.meta { margin-top: 1.4rem; font-size: 0.9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; }
.meta b { color: var(--ink); font-weight: 600; }
.meta a { color: var(--primary); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

.metrics {
  margin-top: 2.2rem;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line);
  display: grid; grid-auto-columns: 1fr; grid-auto-flow: column;
}
.metrics .m { padding: 1.3rem 1.4rem 1.2rem; border-left: 1px solid var(--line); }
.metrics .m:first-child { border-left: 0; padding-left: 0; }
.metrics .n { font-family: var(--head); font-variant-numeric: tabular-nums; font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; color: var(--primary); line-height: 1.05; transition: color 0.35s ease; }
.metrics .l { font-size: 0.82rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.45; }
@media (max-width: 640px) {
  .metrics { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .metrics .m { padding: 1.1rem 1rem; }
  .metrics .m:nth-child(odd) { border-left: 0; padding-left: 0; }
  .metrics .m:nth-child(n+3) { border-top: 1px solid var(--line); }
}

section, .sec {
  margin-top: 3.2rem; padding-top: 2.4rem;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 13rem 1fr; gap: 1.5rem 3rem;
  align-items: start;
}
h2 {
  font-family: var(--head); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em;
  line-height: 1.4; position: sticky; top: 1.5rem;
}
h2 .h2sub { display: block; font-family: var(--body); font-weight: 400; font-size: 0.82rem; color: var(--faint); margin-top: 0.3rem; letter-spacing: 0; }
.sec-body { max-width: 42rem; min-width: 0; }
@media (max-width: 760px) {
  section, .sec { grid-template-columns: 1fr; gap: 1.1rem; }
  h2 { position: static; }
}
.sec-body p { font-size: 0.98rem; color: #33353a; }
.sec-body p + p { margin-top: 1rem; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; position: relative; }
.duo::before { content: ""; position: absolute; left: 50%; top: 0.2rem; bottom: 0.2rem; width: 1px; background: var(--line); }
.duo h3 { font-family: var(--head); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.6rem; }
.duo .col.sol h3 { color: var(--primary); transition: color 0.35s ease; }
.duo p { font-size: 0.92rem; color: #33353a; }
@media (max-width: 640px) {
  .duo { grid-template-columns: 1fr; gap: 1.4rem 0; }
  .duo::before { display: none; }
  .duo .col.sol { border-top: 1px solid var(--line); padding-top: 1.4rem; }
}

/* swimlane */
.seqwrap { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
.seq { min-width: 600px; position: relative; padding: 0 0 1.25rem; }
.lanehead { display: grid; grid-template-columns: 1fr 1.5fr 1fr; border-bottom: 1px solid var(--line); position: relative; z-index: 2; background: var(--panel); }
.lanehead > div { padding: 0.9rem 0.8rem 0.75rem; text-align: center; }
.lanehead b { font-family: var(--head); font-weight: 700; font-size: 0.94rem; display: block; }
.lanehead span { font-size: 0.74rem; color: var(--faint); }
.lanes { position: relative; }
.lanes .tint { position: absolute; top: 0; bottom: 0; left: 28.57%; width: 42.86%; background: var(--primary-soft); opacity: 0.5; }
.lanes .rail { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.lanes .rail.r1 { left: 14.28%; } .lanes .rail.r2 { left: 50%; } .lanes .rail.r3 { left: 85.71%; }
.msg { position: relative; height: 62px; z-index: 1; }
.msg .line { position: absolute; top: 33px; height: 0; border-top: 2px solid var(--primary); transition: border-color 0.35s ease; }
.msg .line::before { content: ""; position: absolute; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.msg .line::after { content: ""; position: absolute; top: -6px; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.msg.right .line::before { left: -3px; }
.msg.right .line::after { right: -2px; border-left: 9px solid var(--primary); }
.msg.left .line::before { right: -3px; }
.msg.left .line::after { left: -2px; border-right: 9px solid var(--primary); }
.msg.dashed .line { border-top-style: dashed; }
.msg .lbl { position: absolute; top: 7px; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.msg .sub { position: absolute; top: 38px; text-align: center; font-size: 0.75rem; color: var(--muted); }
.msg.c2a .line, .msg.c2a .lbl, .msg.c2a .sub { left: 14.28%; width: 35.72%; }
.msg.a2e .line, .msg.a2e .lbl, .msg.a2e .sub { left: 50%; width: 35.71%; }
.msg.self { height: 76px; }
.msg.self .stepcard {
  position: absolute; left: 27%; width: 46%; top: 9px;
  background: var(--panel); border: 1px solid var(--primary-line);
  padding: 0.5rem 0.7rem; text-align: center;
}
.msg.self .stepcard b { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.msg.self .stepcard span { font-size: 0.72rem; color: var(--muted); }
.fig-caption { margin-top: 1rem; font-size: 0.88rem; color: var(--muted); }
.fig-caption b { color: var(--primary); }

/* block diagram (ntu / vext) */
.diagram { border: 1px solid var(--line); background: var(--panel); padding: 1.6rem 1.5rem; }
.dg-node { border: 1px solid var(--line); background: var(--bg); padding: 0.7rem 1rem; max-width: 26rem; margin: 0 auto; text-align: center; }
.dg-node b { display: block; font-family: var(--head); font-weight: 700; font-size: 0.9rem; }
.dg-node span { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 0.1rem; }
.dg-conn { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding: 0.2rem 0; }
.dg-conn .stem { position: relative; width: 2px; height: 30px; background: var(--primary); opacity: 0.55; }
.dg-conn .stem::after { content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%); border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--primary); }
.dg-conn .note { font-size: 0.74rem; color: var(--muted); max-width: 15rem; line-height: 1.45; }
.dg-panel { border: 1px solid var(--primary-line); background: var(--panel); padding: 1.1rem 1.2rem; }
.dg-panel .hd { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 1rem; margin-bottom: 0.9rem; }
.dg-panel .hd b { font-family: var(--head); font-weight: 700; font-size: 0.95rem; }
.dg-panel .hd span { font-size: 0.74rem; color: var(--primary); }
.dg-mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.dg-mod { border: 1px solid var(--line); background: var(--bg); padding: 0.65rem 0.8rem; }
.dg-mod b { display: block; font-size: 0.8rem; font-weight: 600; }
.dg-mod span { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; line-height: 1.5; }
@media (max-width: 640px) { .dg-mods { grid-template-columns: 1fr; } }
.dg-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 0.2rem; }
.dg-side { text-align: center; }
.dg-side .upconn { position: relative; width: 2px; height: 26px; background: var(--primary); opacity: 0.45; margin: 0 auto; }
.dg-side .upconn::after { content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid var(--primary); }
.dg-side .upnote { font-size: 0.7rem; color: var(--muted); margin: 0.15rem 0 0.3rem; }
.dg-side .dg-node { max-width: none; }
@media (max-width: 640px) { .dg-sides { grid-template-columns: 1fr; } }
.dg-pills { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem; }
.dg-pills span { border: 1px solid var(--line); background: var(--bg); padding: 0.3rem 0.85rem; font-size: 0.78rem; font-weight: 600; }
.dg-strip { border: 1px dashed var(--line); padding: 0.55rem 1rem; text-align: center; font-size: 0.76rem; color: var(--muted); margin-top: 0.2rem; }
.dg-gov { border: 1px dashed var(--primary-line); background: var(--primary-soft); padding: 0.8rem 1rem; text-align: center; }
.dg-gov b { display: block; font-family: var(--head); font-weight: 700; font-size: 0.85rem; }
.dg-gov span { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.15rem; }

ul.caps { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2.5rem; }
ul.caps li { border-top: 1px solid var(--line); padding-top: 0.9rem; font-size: 0.92rem; color: var(--muted); transition: border-top-color 0.25s ease; }
ul.caps li:hover { border-top-color: var(--primary); }
ul.caps b { display: block; color: var(--ink); font-family: var(--head); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.3rem; }
@media (max-width: 640px) { ul.caps { grid-template-columns: 1fr; gap: 1.1rem; } }

.stackrows { display: grid; }
.stackrow { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.5rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.stackrow:first-child { border-top: 0; padding-top: 0; }
.stackrow .k { font-family: var(--head); font-weight: 700; font-size: 0.88rem; padding-top: 0.05rem; }
.stackrow .v { font-size: 0.94rem; color: #33353a; }
@media (max-width: 640px) { .stackrow { grid-template-columns: 1fr; gap: 0.25rem; } }

ul.plain { list-style: none; }
ul.plain li { padding-left: 1.4rem; position: relative; margin-top: 0.7rem; font-size: 0.95rem; color: #33353a; }
ul.plain li:first-child { margin-top: 0; }
ul.plain li::before { content: ""; position: absolute; left: 0; top: 0.58rem; width: 0.5rem; height: 0.5rem; background: var(--primary); }

/* index page */
.chips { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips span { border: 1px solid var(--line); background: var(--panel); padding: 0.28rem 0.8rem; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.certline { margin-top: 1.2rem; font-size: 0.88rem; color: var(--muted); }
.contact { margin-top: 0.5rem; font-size: 0.88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.3rem 1.6rem; }
.contact a { color: var(--primary); text-decoration: none; font-weight: 500; }
.contact a:hover { text-decoration: underline; }
.caserows { display: grid; }
a.caserow {
  display: grid; grid-template-columns: 1fr auto auto; gap: 1.5rem; align-items: center;
  padding: 1.1rem 0; border-top: 1px solid var(--line);
  text-decoration: none; color: inherit; transition: border-top-color 0.25s ease;
}
a.caserow:first-child { border-top: 0; padding-top: 0; }
a.caserow:hover { border-top-color: var(--primary); }
a.caserow .cr-t { font-family: var(--head); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; transition: color 0.2s ease; }
a.caserow:hover .cr-t { color: var(--primary); }
a.caserow .cr-s { display: block; font-size: 0.86rem; color: var(--muted); margin-top: 0.25rem; font-weight: 400; font-family: var(--body); }
a.caserow .cr-side { font-size: 0.78rem; color: var(--faint); white-space: nowrap; }
a.caserow .cr-arrow { color: var(--primary); font-weight: 600; transition: transform 0.25s ease; }
a.caserow:hover .cr-arrow { transform: translateX(4px); }
@media (max-width: 640px) { a.caserow { grid-template-columns: 1fr auto; } a.caserow .cr-side { display: none; } }

.backrow { display: inline-block; margin-top: 3rem; font-size: 0.9rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.backrow:hover { text-decoration: underline; }

/* motion (transform/opacity only; disabled under reduced motion, safe without JS) */
@media (prefers-reduced-motion: no-preference) {
  html.js .hero-in { opacity: 0; transform: translateY(12px); animation: heroin 0.7s cubic-bezier(0.16,1,0.3,1) forwards; }
  html.js .hero-in.d1 { animation-delay: 0.06s; }
  html.js .hero-in.d2 { animation-delay: 0.12s; }
  html.js .hero-in.d3 { animation-delay: 0.18s; }
  html.js .hero-in.d4 { animation-delay: 0.24s; }
  @keyframes heroin { to { opacity: 1; transform: none; } }
  html.js .metrics .m { opacity: 0; transform: translateY(10px); animation: heroin 0.6s cubic-bezier(0.16,1,0.3,1) forwards; animation-delay: 0.3s; }
  html.js .metrics .m:nth-child(2) { animation-delay: 0.38s; }
  html.js .metrics .m:nth-child(3) { animation-delay: 0.46s; }
  html.js .metrics .m:nth-child(4) { animation-delay: 0.54s; }

  html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.6s cubic-bezier(0.16,1,0.3,1); }
  html.js .reveal.in { opacity: 1; transform: none; }
  html.js .stagger > * { opacity: 0; transform: translateY(10px); transition: opacity 0.5s cubic-bezier(0.16,1,0.3,1), transform 0.5s cubic-bezier(0.16,1,0.3,1); }
  html.js .stagger.in > * { opacity: 1; transform: none; }
  html.js .stagger.in > *:nth-child(2) { transition-delay: 0.07s; }
  html.js .stagger.in > *:nth-child(3) { transition-delay: 0.14s; }
  html.js .stagger.in > *:nth-child(4) { transition-delay: 0.21s; }
  html.js .stagger.in > *:nth-child(5) { transition-delay: 0.28s; }
  html.js .stagger.in > *:nth-child(6) { transition-delay: 0.35s; }
  html.js .stagger.in > *:nth-child(7) { transition-delay: 0.42s; }
  html.js .stagger.in > *:nth-child(8) { transition-delay: 0.49s; }
  html.js .stagger.in > *:nth-child(9) { transition-delay: 0.56s; }

  html.js .lanes .msg { opacity: 0; transition: opacity 0.45s ease-out, transform 0.5s cubic-bezier(0.16,1,0.3,1); }
  html.js .lanes .msg.right { transform: translateX(-16px); }
  html.js .lanes .msg.left { transform: translateX(16px); }
  html.js .lanes .msg.self { transform: translateY(-8px); }
  html.js .lanes.in .msg { opacity: 1; transform: none; }
  html.js .lanes.in .msg:nth-child(6)  { transition-delay: 0.15s; }
  html.js .lanes.in .msg:nth-child(7)  { transition-delay: 0.3s; }
  html.js .lanes.in .msg:nth-child(8)  { transition-delay: 0.45s; }
  html.js .lanes.in .msg:nth-child(9)  { transition-delay: 0.6s; }
  html.js .lanes.in .msg:nth-child(10) { transition-delay: 0.75s; }
  html.js .lanes.in .msg:nth-child(11) { transition-delay: 0.9s; }
}
