@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,520;12..96,700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light;
  --paper: #efeae1;
  --paper-2: #e6dfd3;
  --ink: #161410;
  --muted: #5c564c;
  --line: #d5ccbf;
  --accent: #163e66;
  --gold: #c6a15a;
  --code: #101318;
  --code-ink: #ebe4d6;
  --ok: #1d6b45;
  --unknown: #8a5a12;
  --shadow: 0 28px 70px rgba(16, 19, 24, 0.22);
  --display: "Bricolage Grotesque", "Segoe UI", "Nirmala UI", "Leelawadee UI", "Yu Gothic", "Malgun Gothic", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: "Segoe UI", "Nirmala UI", "Leelawadee UI", "Yu Gothic", "Malgun Gothic", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.65;
  background:
    radial-gradient(900px 480px at 100% -8%, rgba(22, 62, 102, 0.1), transparent 58%),
    linear-gradient(180deg, #f7f3ec 0%, var(--paper) 280px);
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 640px;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(22, 20, 16, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 20, 16, 0.045) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(180deg, #000 20%, transparent 100%);
}
body.nav-open { overflow: hidden; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.8rem;
  z-index: 20;
}
.skip:focus { top: 0.6rem; }

.wrap { width: min(var(--max), calc(100% - 3rem)); margin: 0 auto; position: relative; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(239, 234, 225, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.2rem; min-height: 4.6rem; }
.brand {
  position: relative;
  padding-left: 2.9rem;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.12rem;
  line-height: 1.1;
}
.brand::before {
  content: "R";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #f3ead2;
  border-radius: 8px;
  font-size: 1.05rem;
}
.brand small {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  font-size: 0.68rem;
}
.nav { display: flex; gap: 0.15rem; align-items: center; font-size: 0.92rem; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
}
.nav a:hover { background: rgba(22, 20, 16, 0.05); }
.nav a[aria-current="page"] { color: var(--accent); background: rgba(22, 62, 102, 0.08); }
.nav-github {
  margin-left: 0.35rem;
  border: 1px solid var(--ink);
  padding: 0.32rem 0.8rem;
}
.lang { position: relative; margin-inline-start: auto; }
.lang-button, .lang-menu a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.lang-button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}
.lang-button:hover, .lang.is-open .lang-button { background: rgba(22, 20, 16, 0.05); }
.flag { width: 1.2rem; height: 0.82rem; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(22, 20, 16, 0.15); }
.lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  width: 15.5rem;
  max-height: min(70vh, 24rem);
  overflow: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #f7f3ec;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(22, 20, 16, 0.12);
}
.lang.is-open .lang-menu { display: grid; }
.lang-menu a {
  color: var(--ink);
  text-decoration: none;
  border-radius: 10px;
  padding: 0.38rem 0.5rem;
}
.lang-menu a:hover, .lang-menu a[aria-current="true"] { background: rgba(22, 62, 102, 0.08); }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .brand { padding-left: 0; padding-right: 2.9rem; }
[dir="rtl"] .brand::before { left: auto; right: 0; }
.nav-github:hover { background: var(--ink); color: var(--paper); }
.menu {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: inherit;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 3.2rem;
  padding: 4.6rem 0 2.2rem;
  align-items: center;
}
.hero:not(:has(.panel)) { grid-template-columns: minmax(0, 1fr); }
.kicker {
  margin: 0 0 1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1, h2, h3, .card h2, .case h2 { font-family: var(--display); }
h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(3.3rem, 6.6vw, 6.15rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
  font-weight: 700;
}
.hero h1 {
  font-size: clamp(2.15rem, 3.5vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
body.page h1 { font-size: clamp(2.4rem, 4.4vw, 4rem); line-height: 0.96; }
.page-intro { padding: 4rem 0 0.4rem; }
.lede { font-size: 1.22rem; max-width: 38rem; color: #3d3832; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.6rem 0 1rem; }
.btn, .btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.45rem 1.15rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--ink);
  font-weight: 650;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.btn { background: var(--ink); color: #f6f1e8; }
.btn:hover { transform: translateY(-2px); background: #2a241c; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.7); }
.fine { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.fine code, p code, .card code { font-family: var(--mono); font-size: 0.92em; }

.meters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.meters li { padding: 1rem 1.2rem 1.05rem 0; }
.meters li + li { border-left: 1px solid var(--line); padding-left: 1.2rem; }
.meters strong {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}
.meters span { display: block; margin-top: 0.2rem; font-family: var(--display); font-size: 1.15rem; letter-spacing: -0.03em; }

.page .panel { max-width: 46rem; }
.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 80px),
    var(--code);
  color: var(--code-ink);
  border-radius: 22px;
  padding: 0 0 1rem;
  min-height: 340px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.panel header {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1.15rem;
  color: #b7b1a6;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #2a3038;
  background: #0c0f13;
}
.panel header::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 14px 0 0 #3c434c, 28px 0 0 #3c434c;
}
.panel::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(228, 201, 138, 0.85), transparent);
  animation: scan 4.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes scan {
  0% { top: 58px; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { top: calc(100% - 64px); opacity: 0; }
}
.trace { counter-reset: line; margin: 0.35rem 0 0.8rem; padding: 0 1.15rem; list-style: none; }
.trace li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.15rem 0.8rem;
  padding: 0.72rem 0 0.72rem 0.15rem;
  border-top: 1px solid #262c33;
  opacity: 0.38;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.trace li:first-child { border-top: 0; }
.trace li::before {
  counter-increment: line;
  content: counter(line, decimal-leading-zero);
  grid-row: 1 / span 2;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #6e675c;
  padding-top: 0.28rem;
}
.trace strong, .trace span { grid-column: 2; min-width: 0; }
.trace li.is-on { opacity: 1; transform: none; }
.trace li.is-on::before { color: var(--gold); }
.trace strong { display: block; font-family: var(--mono); font-size: 0.98rem; font-weight: 500; }
.trace span { color: #b7b1a6; font-size: 0.92rem; }
.step-row { display: flex; gap: 0.45rem; padding: 0 1.15rem; }
.step-row button, .copy {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.78rem;
  border: 1px solid #3a4048;
  background: transparent;
  color: var(--code-ink);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  cursor: pointer;
}
.step-row button[aria-pressed="true"] { background: var(--gold); color: #1a160f; border-color: var(--gold); }

section { padding: 4.4rem 0; }
h2 {
  font-size: clamp(2rem, 3.4vw, 3.15rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
  margin: 0 0 0.8rem;
  font-weight: 700;
}
.section-head {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.8rem;
}
.section-head h2, .section-head .lede { margin: 0; }
.steps, .flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.step {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  padding: 1.15rem 0.15rem 0.2rem;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.step.is-in { opacity: 1; transform: none; }
.step:nth-child(2) { transition-delay: 0.08s; }
.step:nth-child(3) { transition-delay: 0.16s; }
.num { font-family: var(--mono); color: var(--accent); font-size: 0.78rem; letter-spacing: 0.12em; }
.step h3, .card h3, .case h3 { margin: 0.35rem 0 0.45rem; font-size: 1.45rem; letter-spacing: -0.035em; line-height: 1.1; }
.step p, .card p, .case p, .faq p { margin: 0; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.known, .unknown {
  border-radius: 22px;
  padding: 1.7rem 1.6rem 1.8rem;
  min-height: 220px;
}
.known { background: #e5f0e6; box-shadow: inset 0 0 0 1px rgba(29, 107, 69, 0.18); }
.unknown { background: #f7f0e2; box-shadow: inset 0 0 0 1px rgba(138, 90, 18, 0.2); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.card, .faq details, .toc a {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(22, 20, 16, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}
.card {
  border-radius: 18px;
  padding: 1.25rem 1.2rem 1.35rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
a.repo { display: block; color: inherit; text-decoration: none; }
a.repo h3 { color: var(--ink); }
a.repo .star { color: var(--gold); letter-spacing: 0; margin-inline-end: 0.4rem; }
.grid .card:hover, .flow .card:hover { transform: translateY(-4px); border-color: rgba(22, 62, 102, 0.35); }
.card h2, .case h2 { font-size: 1.35rem; letter-spacing: -0.03em; line-height: 1.2; margin: 0.25rem 0 0.5rem; }
.cases { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 0.9rem; }
.cases.quad { grid-template-columns: 1fr 1fr; }
.case {
  border-radius: 22px;
  padding: 1.35rem 1.3rem 1.45rem;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(22, 20, 16, 0.08);
  min-height: 230px;
}
.case:first-child { background: var(--ink); color: #f6f1e8; border-color: var(--ink); }
.case:first-child p, .case:first-child .source { color: #c9c2b6; }
.case:first-child .num { color: var(--gold); }
.source { display: block; margin-top: 1rem; font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }

.toc { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }
.toc a {
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
}
.toc a:hover { border-color: var(--ink); }
.guide { scroll-margin-top: 5.4rem; }
.guide + .guide { margin-top: 0.9rem; }

.session { display: grid; grid-template-columns: 0.85fr 1.25fr 1fr; gap: 0.85rem; }
.session article {
  border-radius: 20px;
  padding: 1.25rem 1.2rem 1.4rem;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(22, 20, 16, 0.08);
}
.session article:nth-child(2) { background: var(--ink); }
.session article:nth-child(2) p { color: #f6f1e8; }
.session article:nth-child(2) .num { color: var(--gold); }
.session p:last-child { font-family: var(--display); font-size: 1.28rem; letter-spacing: -0.03em; line-height: 1.25; color: var(--ink); }
.clients { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0 0 1.6rem; padding: 0; list-style: none; }
.clients li {
  font-family: var(--display);
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  letter-spacing: -0.04em;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.15rem;
}
.limits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.limits p { margin: 0; color: var(--muted); }
.limits strong { display: block; margin-bottom: 0.35rem; color: var(--ink); font-family: var(--display); font-size: 1.15rem; letter-spacing: -0.03em; }
.nav-github, .repo { font-family: var(--mono); letter-spacing: 0; }

.install {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
  background:
    radial-gradient(500px 180px at 100% 0%, rgba(198, 161, 90, 0.18), transparent 60%),
    var(--ink);
  color: #f6f1e8;
  border-radius: 28px;
  padding: 2.2rem 2.1rem;
}
.install h2, .install p { color: #f6f1e8; }
.install .fine, .install .fine a { color: #c9c2b6; }
.install a { color: #e4c98a; }
.command {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: #0c0e12;
  color: var(--code-ink);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px #2c333b;
}
.command code { overflow-wrap: anywhere; }
.faq details { border-radius: 16px; padding: 1rem 1.1rem 1.05rem; }
.faq details + details { margin-top: 0.65rem; }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.faq details p { margin-top: 0.7rem; }
.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2.2rem; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; }
.site-footer nav a { color: inherit; text-decoration: none; }
.site-footer nav a:hover { color: var(--ink); }

@media (max-width: 860px) {
  .wrap { width: min(var(--max), calc(100% - 1.6rem)); }
  .hero, .steps, .split, .grid, .cases, .cases.quad, .install, .flow, .section-head, .meters, .session, .limits { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: clamp(2.35rem, 10.5vw, 3.3rem); }
  .hero h1 { font-size: clamp(1.85rem, 7.2vw, 2.4rem); line-height: 1.08; }
  .meters li + li { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .menu { display: inline-flex; margin-left: 0.45rem; white-space: nowrap; }
  .lang-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: rgba(239, 234, 225, 0.98);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    padding: 0.6rem 1rem 1rem;
  }
  .nav.is-open { display: flex; }
  .lang { width: 100%; }
  .lang-menu { position: static; width: 100%; max-height: 16rem; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .trace li, .step, .btn, .card { transition: none; opacity: 1; transform: none; }
  .panel::after { animation: none; display: none; }
}
