/* notes on systems — 2024 */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #fbfbfa;
  --surface: #ffffff;
  --fg: #14181d;
  --fg-dim: #5c6672;
  --fg-faint: #98a1ac;
  --rule: #e4e6e9;
  --mark: #f3f4f6;

  /* 火焰图配色，自下而上由深至亮。全站唯一的彩色。 */
  --f1: #7c2d12;
  --f2: #9a3412;
  --f3: #c2410c;
  --f4: #ea580c;
  --f5: #f59e0b;
  --f6: #fbbf24;

  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1014;
    --surface: #11161c;
    --fg: #dce1e7;
    --fg-dim: #838e9b;
    --fg-faint: #5b6672;
    --rule: #1e252d;
    --mark: #171d24;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 28px; }

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

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 0 0;
}

.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.wordmark .slash { color: var(--f4); }

.nav {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.nav a { padding-bottom: 2px; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a:focus-visible { color: var(--fg); border-bottom-color: var(--f4); }

/* ---------- hero / flame graph ---------- */

.hero { padding: 50px 0 26px; }

.flame {
  width: 100%;
  max-width: 704px;
  height: auto;
  display: block;
  margin-bottom: 22px;
}
.flame rect {
  stroke: var(--bg);
  stroke-width: 1.2;
  transition: opacity .12s ease;
}
.flame g:hover rect { opacity: .62; }
.flame text {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: rgba(255,255,255,.95);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
  pointer-events: none;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: no-preference) {
  .flame .layer {
    transform-origin: center bottom;
    animation: rise .34s cubic-bezier(.2,.7,.3,1) backwards;
  }
  .flame .layer:nth-child(1) { animation-delay: .00s; }
  .flame .layer:nth-child(2) { animation-delay: .05s; }
  .flame .layer:nth-child(3) { animation-delay: .10s; }
  .flame .layer:nth-child(4) { animation-delay: .15s; }
  .flame .layer:nth-child(5) { animation-delay: .20s; }
  .flame .layer:nth-child(6) { animation-delay: .25s; }
  @keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}

.hint { color: var(--fg-faint); }
@media (hover: none) { .hint { display: none; } }

.flame-cap {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
  margin: 0 0 26px;
  letter-spacing: 0.01em;
}

.lede {
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--fg);
  margin: 0;
  max-width: 44ch;
  text-wrap: balance;
}
.lede em { font-style: normal; color: var(--fg-dim); }

/* ---------- index list ---------- */

.year {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-faint);
}
.year::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.list { list-style: none; margin: 0; padding: 0; }

.item { border-bottom: 1px solid var(--rule); }

.item a {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 0 18px;
  align-items: baseline;
  padding: 13px 0;
}
.item a:hover .t, .item a:focus-visible .t { color: var(--f3); }
.item a:focus-visible { outline: 2px solid var(--f4); outline-offset: 3px; }

.d {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.t { font-size: 16px; letter-spacing: -0.005em; transition: color .12s; }
.t code { font-family: var(--mono); font-size: .92em; }
.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .item a { grid-template-columns: 3.8rem 1fr; }
  .tag { grid-column: 2; padding-top: 2px; }
  .lede { font-size: 18px; }
  /* SVG 等比缩放后标签会糊成一片，宁可不要 —— 色块和 tooltip 还在，
     图形本身仍然读得出来是火焰图。 */
  .flame text { display: none; }
  .hint { display: none; }
  .flame { margin-bottom: 18px; }
}

/* ---------- article ---------- */

.back {
  display: inline-block;
  margin: 36px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.back:hover { color: var(--f3); }

.article { padding: 24px 0 0; max-width: var(--measure); }

.article h1 {
  font-size: 30px;
  line-height: 1.22;
  letter-spacing: -0.028em;
  font-weight: 620;
  margin: 0 0 12px;
}

.byline {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-faint);
  margin: 0 0 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.byline .sep { color: var(--rule); padding: 0 8px; }

.article h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.012em;
  margin: 44px 0 12px;
}

.article p { margin: 0 0 18px; }

.article code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--mark);
  padding: 1.5px 5px;
  border-radius: 3px;
}

.article pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--f4);
  border-radius: 0 4px 4px 0;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 20px;
}
.article pre code { background: none; padding: 0; font-size: inherit; }

.article blockquote {
  margin: 0 0 20px;
  padding-left: 18px;
  border-left: 1px solid var(--rule);
  color: var(--fg-dim);
}

.note {
  font-size: 14px;
  color: var(--fg-dim);
  background: var(--mark);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 0 0 20px;
}

/* ---------- footer ---------- */

.foot {
  margin: 56px 0 0;
  padding: 22px 0 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}
.foot a:hover { color: var(--fg-dim); }

@media (max-width: 480px) {
  .foot { flex-direction: column; gap: 6px; }
  .article h1 { font-size: 25px; }
}
