:root {
  color-scheme: light;
  --text: #13242e;
  --muted: #465963;
  --paper: #f6f6f0;
  --dark: #101a23;
  --mint: #a4ead3;
  --border: #dbe0d8;
  --link: #176b59;
  --key: #9ad0fa;
  --tint: #e7f0f9;
  --deep: #2d6282;
  --media: #1a2c45;
}

body.blue   { --key: #9ad0fa; --tint: #e7f0f9; --deep: #2d6282; --media: #1a2c45; }
body.green  { --key: #98dfbc; --tint: #e2eee5; --deep: #1c694f; --media: #142e2b; }
body.orange { --key: #ffb781; --tint: #f7eadd; --deep: #874919; --media: #362b23; }
body.violet { --key: #c8b8fb; --tint: #ede7f7; --deep: #5f4688; --media: #2a2344; }
body.teal   { --key: #8fd0c8; --tint: #e3f0ee; --deep: #1f635c; --media: #15302e; }
body.gold   { --key: #e8c66a; --tint: #f6efdc; --deep: #7a5c14; --media: #322a16; }
body.slate  { --key: #9fb6c9; --tint: #e6ebef; --deep: #3c5567; --media: #1a2731; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 16px/1.68 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 3px solid #049b76; outline-offset: 4px; }
img, video { max-width: 100%; }
.wrap { width: min(1080px, calc(100% - 64px)); margin-inline: auto; }

/* ---------- masthead ---------- */
.mast {
  background: var(--dark);
  color: #f8f9f4;
  padding-bottom: 58px;
  background-image:
    radial-gradient(115% 85% at 88% 0%, color-mix(in srgb, var(--key) 17%, transparent), transparent 60%),
    radial-gradient(80% 60% at 8% 100%, color-mix(in srgb, var(--key) 8%, transparent), transparent 70%);
}
nav {
  min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid #2d4047;
}
nav .name { font-weight: 780; letter-spacing: .02em; }
nav .name span { color: #acc2bc; font-size: .84rem; margin-left: 9px; font-weight: 500; }
nav .links { display: flex; gap: clamp(13px, 2.4vw, 26px); font-size: .9rem; margin-left: auto; }
nav .links a { color: #cbdad6; }
nav a:hover, footer a:hover { color: var(--mint); }
nav .lang {
  margin-left: 20px; padding: 5px 13px; border-radius: 999px; border: 1px solid #3a4d54;
  color: #c9d8d5; font-size: .84rem; font-weight: 700; white-space: nowrap;
}
nav .lang:hover { color: var(--mint); border-color: var(--mint); }

.hero { padding-top: clamp(30px, 4.6vw, 54px); }
.kicker {
  margin: 0 0 12px; color: var(--key); font-size: .79rem; font-weight: 740;
  letter-spacing: .13em; text-transform: uppercase;
}
.hero h1 {
  margin: 0; max-width: 28ch; font-size: clamp(1.6rem, 2.9vw, 2.3rem);
  line-height: 1.2; letter-spacing: -.022em;
}
.hero .lead {
  max-width: 68ch; margin: 18px 0 0; color: #cddad7;
  font-size: clamp(.98rem, 1.35vw, 1.08rem);
}
.hero .byline { margin: 16px 0 0; color: #9db3ae; font-size: .87rem; }
.cta { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid #3c5259; color: #e6efec; font-size: .9rem; font-weight: 700;
}
.btn:hover { border-color: var(--mint); color: var(--mint); }
.btn.primary { background: var(--mint); border-color: var(--mint); color: #0c2521; }
.btn.primary:hover { background: #c0f9e5; color: #0c2521; }

/* ---------- sections ---------- */
main { padding: 48px 0 76px; }
section + section { margin-top: 56px; }
.sec-head {
  display: flex; align-items: baseline; gap: 13px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 9px; margin-bottom: 24px;
}
.sec-head .num {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em; color: var(--deep);
  background: var(--tint); padding: 3px 9px; border-radius: 6px;
}
h2 { margin: 0; font-size: clamp(1.28rem, 2vw, 1.6rem); letter-spacing: -.02em; }
.sec-head p { margin: 0; color: var(--muted); font-size: .86rem; }
p.body { margin: 0 0 15px; max-width: 74ch; }
p.body:last-child { margin-bottom: 0; }
.two-col { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); gap: 28px; align-items: start; }

.callout {
  border-left: 3px solid var(--key); background: var(--tint);
  padding: 14px 18px; border-radius: 0 10px 10px 0; font-size: .92rem; color: #22323a;
}
.callout strong { color: var(--deep); }

/* ---------- video ---------- */
.video-frame {
  border-radius: 14px; overflow: hidden; background: var(--media);
  border: 1px solid var(--border); line-height: 0;
}
.video-frame video { display: block; width: 100%; height: auto; }
figcaption { margin-top: 10px; color: var(--muted); font-size: .86rem; }

/* ---------- steps ---------- */
.steps { counter-reset: step; display: grid; gap: 13px; }
.step {
  position: relative; padding: 15px 18px 15px 54px; border: 1px solid var(--border);
  border-radius: 12px; background: #fdfdf8;
}
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 15px; top: 15px; width: 25px; height: 25px; border-radius: 50%;
  background: var(--tint); color: var(--deep); font-weight: 800; font-size: .78rem;
  display: grid; place-items: center;
}
.step strong { display: block; margin-bottom: 3px; color: var(--deep); font-size: .96rem; }
.step p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.58; }

/* ---------- figures ---------- */
figure { margin: 0; }
.fig-lg img {
  display: block; width: 100%; border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gallery img {
  display: block; width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff;
}

/* ---------- case blocks ---------- */
.case { display: grid; gap: 13px; }
.case-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 0 rgba(16, 26, 35, .03);
}
.case-card .tagline {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 15px; font-size: .74rem; font-weight: 750; letter-spacing: .07em;
  text-transform: uppercase; color: #fff; background: var(--deep);
}
.case-card .tagline em { font-style: normal; opacity: .78; letter-spacing: .02em; text-transform: none; }
.case-card.bad .tagline { background: #8a3b2f; }
.case-card.good .tagline { background: #1e6b4f; }
.case-card pre {
  margin: 0; padding: 14px 16px; font: .82rem/1.62 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: #22303a; background: #fbfbf6;
}
.case-card pre b { color: #8a3b2f; font-weight: 700; }
.case-card pre i { color: #1e6b4f; font-style: normal; font-weight: 700; }
.case-card .note { padding: 10px 16px; font-size: .82rem; color: var(--muted); border-top: 1px dashed var(--border); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.tbl caption {
  caption-side: top; text-align: left; color: var(--muted); font-size: .82rem; padding-bottom: 9px;
}
table.tbl th, table.tbl td { padding: 8px 11px; border-bottom: 1px solid var(--border); text-align: right; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl thead th {
  background: var(--tint); color: var(--deep); font-weight: 720; font-size: .82rem;
  border-bottom: 1px solid color-mix(in srgb, var(--deep) 22%, transparent);
}
table.tbl tbody tr:nth-child(even) { background: #fbfbf6; }
table.tbl tbody tr:hover { background: #f4f6ee; }
table.tbl td.best { font-weight: 800; color: var(--deep); }
table.tbl td.dim { color: var(--muted); }

table.kv { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.kv th {
  width: 132px; text-align: left; vertical-align: top; padding: 7px 12px 7px 0;
  color: var(--deep); font-weight: 700; white-space: nowrap;
}
table.kv td { padding: 7px 0; border-bottom: 1px solid var(--border); color: #26343c; }
table.kv tr:last-child td { border-bottom: none; }
table.kv.kv-wide { display: block; columns: 2; column-gap: 40px; margin-bottom: 30px; }
table.kv.kv-wide tr { break-inside: avoid; display: block; margin-bottom: 2px; }
table.kv.kv-wide th { width: 112px; }
.tbl-stack { display: grid; gap: 26px; }

/* result tables are cropped from the camera-ready PDF */
figure.ptab {
  margin: 0; padding: 20px 22px 15px; border-radius: 14px;
  background: #ffffff; border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 26, 35, .04);
}
figure.ptab a { display: block; }
figure.ptab img { display: block; width: 100%; height: auto; }
figure.ptab.narrow img { max-width: 78%; margin: 0 auto; }
@media (max-width: 760px) { figure.ptab.narrow img { max-width: 100%; } }
figure.ptab figcaption {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
  font-size: .82rem; line-height: 1.6; color: var(--muted);
}
figure.ptab figcaption b { color: var(--deep); font-weight: 700; margin-right: 4px; }
@media (max-width: 640px) {
  figure.ptab { padding: 12px 12px 10px; }
}

/* ---------- quoted results (paper PDF not redistributable) ---------- */
.quotes { display: grid; gap: 14px; margin-bottom: 6px; }
blockquote.quote {
  margin: 0; padding: 18px 22px 15px; border-radius: 12px;
  background: #fdfdf8; border: 1px solid var(--border);
  border-left: 3px solid var(--deep);
}
blockquote.quote p { margin: 0; font-size: .95rem; line-height: 1.66; color: #22333c; }
blockquote.quote cite {
  display: block; margin-top: 9px; font-style: normal; font-size: .78rem;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.q-note { margin: 12px 0 0; font-size: .82rem; color: var(--muted); }

/* ---------- takeaways ---------- */
.takeaways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.take {
  padding: 15px 17px; border-radius: 12px; background: #fdfdf8;
  border: 1px solid var(--border); border-top: 3px solid var(--key);
}
.take b { display: block; margin-bottom: 5px; font-size: .93rem; color: var(--deep); }
.take p { margin: 0; font-size: .87rem; color: var(--muted); line-height: 1.55; }

/* ---------- footer ---------- */
footer { background: var(--dark); color: #d6e3df; padding: 26px 0; }
footer .wrap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  font-size: .87rem; flex-wrap: wrap;
}

@media (max-width: 820px) {
  .wrap { width: calc(100% - 36px); }
  .mast { padding-bottom: 38px; }
  nav { flex-wrap: wrap; gap: 9px; padding-bottom: 9px; }
  nav .links { margin-left: 0; order: 3; width: 100%; }
  nav .lang { margin-left: auto; }
  .two-col, .gallery, .takeaways { grid-template-columns: 1fr; }
  table.kv.kv-wide { columns: 1; }
  section + section { margin-top: 40px; }
  table.kv th { width: 108px; }
}
