/* ============================================================
   AI 与全栈开发技术学习站 · 设计系统 (mobile-first)
   ============================================================ */
:root {
  --bg: #f4f3f0;
  --card: #ffffff;
  --card-alt: #faf9f7;
  --line: #e7e6e3;
  --line-soft: #f0efec;
  --ink: #141414;
  --ink-2: #1f1f1f;
  --ink-3: #4a4a4a;
  --ink-4: #6a6a68;
  --ink-5: #9a9a9a;
  --ink-6: #b2b1ad;
  --accent: oklch(0.55 0.17 256);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.10);
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244,243,240,.86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
}
.nav-brand {
  display: flex; align-items: center; gap: 9px;
  font: 700 16px/1 var(--sans); letter-spacing: -.01em; color: var(--ink);
  flex: none;
}
.nav-brand .logo {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, oklch(0.6 0.17 256), oklch(0.62 0.17 300));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font: 700 13px/1 var(--mono);
}
.nav-links { display: none; margin-left: auto; align-items: center; gap: 2px; }
.nav-links a {
  font: 500 12.5px/1 var(--sans); color: var(--ink-4);
  padding: 7px 11px; border-radius: 8px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: #eceae6; color: var(--ink); }
.nav-links a.active { color: var(--ink); background: #e7e5e0; }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 17px; color: var(--ink-3);
}
.lang-toggle {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 34px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font: 600 12.5px/1 var(--mono); letter-spacing: .04em; color: var(--ink-3);
  transition: background .15s, color .15s, border-color .15s;
}
.lang-toggle:hover { background: #eceae6; color: var(--ink); border-color: #d8d7d3; }
.lang-toggle { margin-left: auto; }
.nav-drawer {
  display: none; flex-direction: column; gap: 2px;
  max-width: 1180px; margin: 0 auto; padding: 6px 12px 12px;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  font: 500 14px/1 var(--sans); color: var(--ink-3);
  padding: 12px 12px; border-radius: 9px;
}
.nav-drawer a.active { background: #e7e5e0; color: var(--ink); }
.nav-drawer a:active { background: #eceae6; }

@media (min-width: 860px) {
  .nav-links { display: flex; margin-left: auto; }
  .nav-links ~ .lang-toggle { margin-left: 4px; }
  .nav-toggle { display: none; }
  .nav-drawer { display: none !important; }
}

/* ---------- 页面容器 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 18px 88px; }
@media (min-width: 760px) { .wrap { padding: 40px 32px 100px; } }

/* ---------- 页头 ---------- */
.page-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.page-kicker {
  font: 600 11px/1 var(--mono); letter-spacing: .14em; color: var(--accent);
  text-transform: uppercase;
}
.page-title {
  font: 700 clamp(24px, 6vw, 34px)/1.08 var(--sans);
  letter-spacing: -.02em; color: var(--ink); margin: 0;
}
.page-sub { font: 400 13px/1.6 var(--sans); color: var(--ink-4); max-width: 780px; }
.page-note { font: 400 11.5px/1.6 var(--mono); color: var(--ink-5); max-width: 820px; }

/* ---------- 区块 ---------- */
.section { margin-top: 40px; }
.section-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.section-title {
  display: flex; align-items: center; gap: 9px;
  font: 600 clamp(16px, 3.6vw, 19px)/1.15 var(--sans); color: var(--ink); margin: 0;
}
.section-title .sq { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.section-sub { font: 400 12px/1.55 var(--mono); color: var(--ink-5); }

/* ---------- 卡片通用 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 17px; display: flex; flex-direction: column; gap: 9px;
}
.card-en { font: 500 8.5px/1.2 var(--mono); letter-spacing: .06em; color: #aaaaa6; }

/* grids */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
.g4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 620px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .g3 { grid-template-columns: 1fr 1fr 1fr; } .g4 { grid-template-columns: repeat(4,1fr); } }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 11.5px/1.3 var(--sans); color: #3a3a3a;
  background: #f5f4f1; border: 1px solid #ececea; border-radius: 8px; padding: 5px 10px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* logo pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 3px; border: 1px solid #e7e7e4; border-radius: 999px;
  background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.pill:hover { border-color: #d5d4d0; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.pill .fav {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px; flex: none; background: #fff; border: 1px solid #eeeeec;
}
.pill .fav img { width: 15px; height: 15px; object-fit: contain; }
.pill span.nm { font: 500 11.5px/1.1 var(--sans); color: #2a2a2a; white-space: nowrap; }

/* section-label */
.slabel { font: 600 9px/1 var(--mono); letter-spacing: .12em; color: #b0b0b0; text-transform: uppercase; }

/* interactive hint */
.tap-hint { font: 500 9.5px/1.3 var(--mono); letter-spacing: .04em; color: #bcbcb8; }

/* horizontal flow → wraps / stacks on mobile */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.flow .arrow {
  align-self: center; color: #cfcec9; font-size: 16px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 640px) {
  .flow { flex-direction: column; }
  .flow .arrow { transform: rotate(90deg); align-self: center; }
}

/* pill button / tabs */
.tabs {
  display: flex; gap: 4px; padding: 4px; background: #eceae6; border-radius: 999px;
  width: max-content; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs button {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  font: 600 12.5px/1 var(--sans); color: var(--ink-4); padding: 9px 15px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* code block */
.code {
  background: #1c1c1e; border-radius: 10px; padding: 13px 14px; overflow-x: auto;
  font: 500 11.5px/1.65 var(--mono); color: #e6e6e6; white-space: pre;
}

/* ---------- 底部 ---------- */
.foot {
  max-width: 1180px; margin: 0 auto; padding: 30px 18px 46px;
  border-top: 1px solid var(--line); color: var(--ink-5);
  font: 400 11.5px/1.7 var(--mono); display: flex; flex-direction: column; gap: 6px;
}
.foot a { color: var(--ink-4); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 详情弹层 (bottom sheet on mobile, modal on PC) ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(20,20,20,.4);
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 101; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.18);
  max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
}
.sheet.show { transform: translateY(0); }
.sheet-grab { width: 40px; height: 4px; border-radius: 3px; background: #d8d7d3; margin: -6px auto 14px; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 17px; color: #888;
  display: flex; align-items: center; justify-content: center;
}
@media (min-width: 720px) {
  .sheet-mask { display: flex; align-items: center; justify-content: center; padding: 24px; }
  .sheet {
    position: relative; inset: auto; left: auto; right: auto; bottom: auto;
    max-width: 720px; width: 100%; border-radius: 16px; max-height: 84vh;
    transform: translateY(16px) scale(.98); box-shadow: var(--shadow-lg);
  }
  .sheet.show { transform: translateY(0) scale(1); }
  .sheet-grab { display: none; }
}

.sheet h3 { margin: 0; font: 700 19px/1.2 var(--sans); letter-spacing: -.01em; color: var(--ink); }
.sheet .sub { font: 500 10px/1.3 var(--mono); letter-spacing: .05em; color: var(--ink-5); }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-block { display: flex; flex-direction: column; gap: 6px; }
.detail-block .body { font: 400 12px/1.65 var(--sans); color: var(--ink-3); }
.hr { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* utility */
.muted { color: var(--ink-5); }
.stack { display: flex; flex-direction: column; }
.bar { height: 3px; border-radius: 2px; }
.hide-sm { display: none; }
@media (min-width: 720px) { .hide-sm { display: initial; } }
