/* Self-hosted SIL OFL 1.1 fonts. Do not load from a font CDN. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("fonts/NotoSansSC-Regular-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("fonts/NotoSansSC-Medium-subset.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("fonts/NotoSansSC-Bold-subset.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Light default — inner pages use paper; home overrides --bg */
  --bg: #F6F5F2;
  --bg-home: #FCFCFD;
  --surface: #FFFFFF;
  --text: #111111;
  --muted: #444444;
  --accent: #1B3A57;
  --accent-2: #3D5A73;
  --accent-soft: #E8EEF4;
  --cyan: #0A6473;
  --cyan-soft: #E3F4F6;
  --line: #E4E7EB;
  --dot: #D5DAE0;
  --danger: #8F2D2D;
  --shadow: 0 6px 18px rgba(27, 58, 87, 0.10);

  --sans: "IBM Plex Sans", "Noto Sans SC", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --step-hero: clamp(2.1rem, 5vw, 3rem);
  --step-h1: clamp(1.6rem, 3.6vw, 2.2rem);
  --step-h2: 1.25rem;
  --step-body: 1rem;
  --step-small: 0.875rem;
  --step-label: 0.8125rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-card: 12px;
  --radius-tag: 6px;
  --radius-pill: 999px;
  --gap-bento: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0F14;
    --bg-home: #0B0F14;
    --surface: #121821;
    --text: #E8EDF2;
    --muted: #9AA3AD;
    --accent: #7EE0D0;
    --accent-2: #8CB4DC;
    --accent-soft: #1A2A32;
    --cyan: #7EE0D0;
    --cyan-soft: #14303A;
    --line: #27303A;
    --dot: #1C242C;
    --danger: #E08A8A;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.75;
}
body.page-home { background: var(--bg-home); }

main.wrap {
  flex: 1 0 auto;
  width: 100%;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.08em 0.36em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text);
}

/* top bar: brand left, short nav right */
.bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); text-decoration: none; }

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
}
.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--accent); text-decoration: none; }
.topnav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* hero (home) */
.hero {
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-home);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  padding: 1.5rem 0 3.5rem;
  margin-bottom: var(--space-7);
}
.hero-title {
  margin: 3.5rem 0 0.75rem;
  font-size: var(--step-hero);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero-sub {
  margin: 0 0 var(--space-5);
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 40rem;
}
.hero-action { margin: 0; }
.btn-text {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.25rem 0;
  border-bottom: 2px solid var(--accent);
  text-decoration: none;
}
.btn-text:hover { opacity: 0.8; text-decoration: none; }

/* inner header */
.site-bar {
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0 1.1rem;
  margin-bottom: 2.75rem;
  background: var(--bg);
}

/* badges & tags */
.badge {
  display: inline-block;
  font-size: var(--step-label);
  font-weight: 600;
  line-height: 1.5;
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius-pill);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
}
.badge-status {
  color: var(--accent-2);
  background: var(--accent-soft);
}
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tags li {
  font-family: var(--mono);
  font-size: var(--step-label);
  line-height: 1.5;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-tag);
  color: var(--muted);
}

/* Bento: mobile-first, DOM order 主项目 → 看板 → 能力 → 学习项目 */
.cards {
  display: grid;
  gap: var(--gap-bento);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-8);
}
.card-main { order: 0; }
.card-board { order: 1; }
.card-skills { order: 2; }
.card-learn { order: 3; }

@media (min-width: 800px) {
  .cards {
    grid-template-columns: repeat(12, 1fr);
    grid-template-areas:
      "main main main main main main main main board board board board"
      "main main main main main main main main board board board board"
      "learn learn learn learn learn learn learn learn skills skills skills skills";
  }
  .card-main,
  .card-board,
  .card-skills,
  .card-learn { order: 0; }
  .card-main { grid-area: main; }
  .card-board { grid-area: board; }
  .card-learn { grid-area: learn; }
  .card-skills { grid-area: skills; }
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 1.5rem 1.5rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card h2 {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}
.card .meta {
  margin: -0.3rem 0 0;
  color: var(--muted);
  font-size: var(--step-small);
  line-height: 1.5;
}
.card-text { margin: 0; color: var(--muted); flex: 1; }
.card .tags { margin-top: auto; padding-top: 0.5rem; }

.card-points {
  margin: 0;
  padding: 0 0 0 1.15rem;
  color: var(--muted);
  font-size: var(--step-small);
  line-height: 1.55;
}
.card-points li + li { margin-top: 0.25rem; }

.card-thumb {
  width: 100%;
  margin: 0.25rem 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-home);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 16px 16px;
  padding: 0.6rem;
}
.card-thumb svg { display: block; width: 100%; height: auto; }
.card-thumb .box,
.diagram .box { fill: var(--surface); stroke: var(--muted); stroke-width: 1.2; }
.card-thumb .box.stack,
.diagram .box.stack { stroke: var(--line); }
.card-thumb .box.key,
.diagram .box.key { stroke: var(--accent); stroke-width: 1.8; }
.card-thumb .box.accent,
.diagram .box.accent { stroke: var(--cyan); stroke-width: 1.8; fill: var(--cyan-soft); }
.card-thumb .t,
.diagram .t { fill: var(--text); font: 700 15px var(--sans); text-anchor: middle; }
.diagram .t { font-size: 17px; }
.card-thumb .ts,
.diagram .ts { fill: var(--muted); font: 13px var(--sans); text-anchor: middle; }
.diagram .tl { fill: var(--muted); font: 12px var(--sans); }
.card-thumb .ln,
.diagram .ln { stroke: var(--muted); stroke-width: 1.4; }
.card-thumb .ah,
.diagram .ah { fill: var(--muted); }

/* doc pages */
.doc { max-width: 760px; }
.doc-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.doc h1 {
  margin: 0;
  font-size: var(--step-h1);
  font-weight: 700;
  line-height: 1.25;
}
.doc .lede {
  margin: 0.4rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}
.doc .meta {
  margin: 0;
  color: var(--muted);
  font-size: var(--step-small);
  line-height: 1.5;
}
.doc h2 {
  margin: 2.6rem 0 0.8rem;
  font-size: var(--step-h2);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.4;
}
.doc h3 {
  margin: 1.6rem 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.doc p { margin: 0 0 1.1rem; }

.back {
  display: inline-block;
  margin: 3rem 0 4rem;
  text-decoration: none;
  font-size: 0.95rem;
}
.back:hover { text-decoration: underline; }

/* diagram: may break out to .wrap full width */
.diagram {
  margin: 0 0 2.25rem;
  padding: 1.25rem 1.25rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background-color: var(--surface);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 600px; height: auto; }
.diagram figcaption {
  margin-top: 0.6rem;
  font-size: var(--step-small);
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* steps */
.steps {
  list-style: none;
  margin: 0 0 1.4rem;
  padding: 0;
  display: flex;
  gap: 0;
  counter-reset: none;
}
.steps li {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.92rem;
  font-weight: 600;
}
.steps li + li { border-left: none; }
.steps li:first-child { border-radius: 10px 0 0 10px; }
.steps li:last-child { border-radius: 0 10px 10px 0; border: 1px solid var(--cyan); }
.steps li:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 1.2rem;
  height: 1.2rem;
  line-height: 1.2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 50%;
}
.step-n {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  text-align: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: var(--step-label);
  color: var(--accent);
  background: var(--accent-soft);
}
.steps li:last-child .step-n {
  color: var(--cyan);
  background: var(--cyan-soft);
}

@media (max-width: 600px) {
  .steps { flex-direction: column; }
  .steps li + li { border-left: 1px solid var(--line); border-top: none; }
  .steps li:first-child { border-radius: 10px 10px 0 0; }
  .steps li:last-child { border-radius: 0 0 10px 10px; border: 1px solid var(--cyan); }
  .steps li:not(:last-child)::after {
    content: "↓";
    right: auto;
    left: 1.05rem;
    top: auto;
    bottom: -0.6rem;
    transform: none;
  }
}

/* todo list */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li {
  position: relative;
  padding: 0.55rem 0 0.55rem 2rem;
  border-bottom: 1px dashed var(--line);
}
.todo li:last-child { border-bottom: none; }
.todo li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.95rem;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  background: var(--surface);
}

/* skills */
.skill-cols {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .skill-cols { grid-template-columns: 1fr 1fr; }
}
.skill-cols h2 { margin-top: 0; }
.plain {
  margin: 0;
  padding: 0 0 0 1.15rem;
}
.plain li + li { margin-top: 0.35rem; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.15rem;
  border-left: 2px solid var(--line);
}
.timeline li {
  position: relative;
  padding: 0 0 1.25rem 1.25rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -1.15rem;
  top: 0.55rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.timeline .time {
  display: block;
  font-family: var(--mono);
  font-size: var(--step-small);
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.15rem;
}

/* ICP footer */
.site-foot {
  margin-top: auto;
  padding: 2.25rem 0 1.75rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--step-small);
  line-height: 1.5;
}
.site-foot a {
  color: var(--muted);
  text-decoration: none;
}
.site-foot a:hover,
.site-foot a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .card:hover { transform: none; }
}

@media print {
  :root {
    --bg: #F6F5F2;
    --bg-home: #F6F5F2;
    --surface: #FFFFFF;
    --text: #111111;
    --muted: #444444;
    --accent: #1B3A57;
    --accent-2: #3D5A73;
    --accent-soft: #E8EEF4;
    --cyan: #0A6473;
    --cyan-soft: #E3F4F6;
    --line: #E4E7EB;
    --dot: #F6F5F2;
    --danger: #8F2D2D;
    --shadow: none;
  }
  body,
  .hero,
  .diagram,
  .card-thumb {
    background-color: #F6F5F2 !important;
    background-image: none !important;
    color: #111111;
  }
  .card { box-shadow: none; transform: none; }
  .site-bar { margin-bottom: 1rem; }
  .back { margin-bottom: 1rem; }
  a { color: #1B3A57; }
}
