:root {
  /* light IDE palette */
  --bg: #e7ebf0;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #656d76;
  --faint: #8c959f;
  --line: #cdd4dd;
  --line-soft: #dbe0e8;
  /* syntax accents */
  --blue: #0969da;     /* keyword / link */
  --green: #1a7f37;    /* string / comment-ok */
  --purple: #8250df;   /* function */
  --orange: #bc4c00;   /* number / const */
  --red: #cf222e;      /* attention */
  --cmt: #4a5361;      /* comment grey */
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* subtle grid, like an editor canvas */
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* comment / prompt helpers */
.cmt { color: var(--cmt); }
.cmt::before { content: "// "; }
.kw { color: var(--purple); }
.str { color: var(--green); }
.prompt { color: var(--green); }
.prompt::before { content: "$ "; color: var(--faint); }

/* ---------- top bar (tab strip) ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .wrap {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 46px;
}
.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--ink);
  padding-right: 18px;
}
.brand a { display: flex; align-items: center; }
.brand .logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  margin-right: 9px;
  border: 1px solid var(--line-soft);
  object-fit: cover;
}
.brand .dot { color: var(--blue); }
.navlinks { display: flex; align-items: stretch; margin-left: auto; }
.navlinks a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  color: var(--muted);
  border-left: 1px solid var(--line-soft);
  white-space: nowrap;
}
.navlinks a::before { content: "~/"; color: var(--faint); }
.navlinks a.ext::before { content: ""; }
.navlinks a:hover { color: var(--blue); background: var(--bg); }
.navlinks a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg);
  border-bottom: 2px solid var(--blue);
}

/* mobile hamburger (checkbox hack) */
.nav-toggle { display: none; }
.nav-burger { display: none; }

/* ---------- terminal window ---------- */
.term {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--bg), var(--panel));
}
.dot3 { display: flex; gap: 6px; }
.dot3 i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.dot3 .r { background: #ff5f57; }
.dot3 .y { background: #febc2e; }
.dot3 .g { background: #28c840; }
.term-title { font-size: 12px; color: var(--faint); margin-left: 6px; }
.term-body { padding: 22px 20px; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 40px; }
.hero .line { white-space: pre-wrap; }
.hero h1 {
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 4px 0 2px;
}
.hero h1 .zh { color: var(--muted); font-weight: 600; font-size: 0.6em; }
.out { color: var(--ink); }
.out.str { color: var(--green); }
.hero .row { margin: 3px 0; }
.cursor {
  display: inline-block;
  width: 9px;
  height: 1.05em;
  background: var(--blue);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.tags { margin-top: 6px; color: var(--muted); }
.tags .t { color: var(--orange); }
.hero .lnk { color: var(--blue); margin-right: 14px; }
.hero .lnk:hover { text-decoration: underline; }

/* ---------- breadcrumb ---------- */
.crumb { font-size: 12px; color: var(--faint); padding-top: 22px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--blue); }

/* ---------- section ---------- */
section { padding: 40px 0; }
.sec-head { margin-bottom: 22px; font-size: 15px; }
.sec-head .hash { color: var(--faint); }
.sec-head b { color: var(--cmt); font-weight: 400; }
.sec-head b::before { content: "// "; }

/* ---------- home nav cards ---------- */
.navcards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.navcard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  transition: border-color .12s, transform .12s;
}
.navcard:hover { border-color: var(--blue); transform: translateY(-2px); }
.navcard .k { color: var(--cmt); font-size: 12px; }
.navcard .k::before { content: "// "; }
.navcard h3 { font-size: 18px; margin: 8px 0 6px; letter-spacing: -0.01em; }
.navcard h3::before { content: "→ "; color: var(--blue); }
.navcard p { color: var(--muted); font-size: 13px; }
.navcard .go { color: var(--blue); font-size: 12px; margin-top: 12px; display: inline-block; }
.navcard .go::before { content: "$ open "; color: var(--faint); }

/* ---------- feature (repo + table) ---------- */
.feature .flabel { color: var(--cmt); font-size: 12px; }
.feature .flabel::before { content: "// "; }
.feature h3 { font-size: 18px; margin: 6px 0 10px; }
.feature h3 a { color: var(--blue); }
.feature h3 a:hover { text-decoration: underline; }
.feature p { color: var(--muted); max-width: 680px; }

table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
td.cat { color: var(--purple); white-space: nowrap; }
td .pkg a { color: var(--blue); font-weight: 600; }
td .pkg a:hover { text-decoration: underline; }
td .desc { color: var(--cmt); }
td .desc::before { content: "// "; }

/* ---------- two column ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.group { margin-bottom: 22px; }
.group:last-child { margin-bottom: 0; }
.group h4 {
  font-size: 12px;
  color: var(--faint);
  font-weight: 600;
  letter-spacing: 0.03em;
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.group h4::before { content: "▸ "; color: var(--blue); }
.item { padding: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.item a.name { color: var(--blue); font-weight: 600; }
.item a.name:hover { text-decoration: underline; }
.item .cmt { font-size: 13px; }
.inline-list a { color: var(--blue); }
.inline-list a:hover { text-decoration: underline; }
.inline-list .sep { color: var(--faint); }

/* ---------- badge ---------- */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--orange);
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0 6px;
  border-radius: 4px;
  vertical-align: middle;
}
.badge::before { content: "["; color: var(--faint); }
.badge::after { content: "]"; color: var(--faint); }
.badge.awe { color: var(--purple); }

/* ---------- product cards ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 16px; }
.card .ctype { font-size: 11px; color: var(--purple); margin-bottom: 8px; }
.card .ctype::before { content: "# "; color: var(--faint); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); background: var(--panel); margin-top: auto; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 22px; padding-bottom: 40px; font-size: 12px; color: var(--faint); }
footer a { color: var(--muted); }
footer a:hover { color: var(--blue); }

@media (max-width: 414px) {
  .wrap { padding: 0 16px; }
}

@media (max-width: 800px) {
  .topbar .wrap { position: relative; }
  .brand { flex: 1; }
  .nav-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 46px;
    cursor: pointer;
  }
  .nav-burger span,
  .nav-burger span::before,
  .nav-burger span::after {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    transition: transform .18s, opacity .18s;
  }
  .nav-burger span { position: relative; }
  .nav-burger span::before { content: ""; position: absolute; top: -6px; }
  .nav-burger span::after { content: ""; position: absolute; top: 6px; }
  .nav-toggle:checked ~ .nav-burger span { background: transparent; }
  .nav-toggle:checked ~ .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span::after { transform: translateY(-6px) rotate(-45deg); }
  .navlinks {
    position: absolute;
    top: 46px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 16px rgba(0,0,0,.06);
    display: none;
  }
  .nav-toggle:checked ~ .navlinks { display: flex; }
  .navlinks a {
    height: 44px;
    padding: 0 20px;
    border-left: none;
    border-top: 1px solid var(--line-soft);
  }
  .navlinks a[aria-current="page"] {
    border-bottom: none;
    border-left: 3px solid var(--blue);
    padding-left: 17px;
  }
}

@media (max-width: 720px) {
  body { background-image: none; }
  .cols, .prod-grid, .navcards { grid-template-columns: 1fr; gap: 18px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px; margin-bottom: 8px; background: #ffffff80; }
  td { border: none; padding: 3px 6px; }
}
