/* shermanhayes.com — hand-written. System fonts only, no external requests, no JS. */

:root {
  --bg:        #ffffff;
  --surface:   #f6f7f9;
  --ink:       #16181d;
  --muted:     #5a626e;
  --faint:     #8b93a1;
  --line:      #e3e6ea;
  --rule:      #cdd3da;
  --accent:    #1b4d8f;
  --accent-2:  #143a6b;
  --visited:   #6d3d8a;
  --flag:      #b03a1f;
  --sel:       #d6e4f7;

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

  --measure: 46rem;   /* prose column */
  --page:    52rem;   /* container: figures and tables get the extra 6rem */
  --gap: clamp(1.15rem, 4vw, 2rem);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1115;
    --surface:   #171b22;
    --ink:       #e6e9ee;
    --muted:     #98a1b0;
    --faint:     #6b7482;
    --line:      #252b34;
    --rule:      #39424e;
    --accent:    #7aa8e8;
    --accent-2:  #a2c4f2;
    --visited:   #b08ad4;
    --flag:      #e0745a;
    --sel:       #1e3454;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* footer stays at the bottom on short pages */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
@supports (min-height: 100dvh) {
  body { min-height: 100dvh; }
}
::selection { background: var(--sel); }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gap); width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--line); }
.masthead .wrap {
  display: flex; align-items: baseline; gap: .75rem 1.1rem; flex-wrap: wrap;
  padding-top: 1.15rem; padding-bottom: 1.15rem;
  font-family: var(--mono);
}
.name { font-size: .95rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.name:hover { color: var(--accent); text-decoration: none; }
.loc { font-size: .74rem; color: var(--faint); letter-spacing: .02em; }
.masthead nav { margin-left: auto; display: flex; gap: 1.05rem; font-size: .78rem; }
.masthead nav a { color: var(--muted); }
.masthead nav a:hover { color: var(--ink); text-decoration: none; }
.masthead nav a[aria-current="page"] { color: var(--accent); }
@media (max-width: 30rem) {
  .masthead nav { margin-left: 0; width: 100%; gap: .95rem; }
}

/* ---------- shell ---------- */
main { flex: 1 0 auto; padding: clamp(2.2rem, 6vw, 3.6rem) 0 1.5rem; }

/* prose stays narrow and left-aligned; figures and tables use the full container */
.intro, .posts, .more, .count,
article > p, article > h2, article > h3, article > ul, article > ol,
article > blockquote, article > pre, .footnotes { max-width: var(--measure); }

.intro { font-size: 1.15rem; line-height: 1.6; margin: 0 0 2.8rem; color: var(--ink); }

/* ---------- home list ---------- */
.section {
  font-family: var(--mono); font-size: .74rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint); margin: 0 0 1.4rem;
  padding-bottom: .55rem; border-bottom: 1px solid var(--line); max-width: var(--measure);
}
ul.posts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2.1rem; }
.posts .when { margin: 0 0 .3rem; display: flex; align-items: baseline; gap: .7rem; }
.posts a.title {
  font-size: 1.22rem; font-weight: 650; letter-spacing: -.012em; line-height: 1.3;
  color: var(--ink); display: inline-block;
}
.posts a.title:hover { color: var(--accent); text-decoration: none; }
.posts a.title:visited { color: var(--visited); }
.posts .dek { margin: .35rem 0 0; color: var(--muted); font-size: .98rem; line-height: 1.55; }
.more { margin: 2.6rem 0 0; font-family: var(--mono); font-size: .82rem; }

time, .when, .meta, .count {
  font-family: var(--mono); font-size: .74rem; color: var(--faint);
  letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.tag {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 2px;
  padding: .08rem .38rem; white-space: nowrap;
}
.tag.flag { color: var(--flag); border-color: var(--flag); }

/* ---------- article ---------- */
article h1 {
  font-size: clamp(1.65rem, 4.4vw, 2.05rem); line-height: 1.18; letter-spacing: -.022em;
  font-weight: 680; text-wrap: balance; margin: 0 0 .55rem; max-width: var(--measure);
}
.meta { display: flex; align-items: baseline; gap: .7rem; margin: 0 0 2.4rem; }
article p { margin: 0 0 1.25rem; }
article h2 {
  font-size: 1.12rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.35;
  margin: 2.5rem 0 .9rem;
}
article ul, article ol { margin: 0 0 1.25rem; padding-left: 1.3rem; }
article li { margin-bottom: .5rem; }
article a { text-decoration: underline; text-underline-offset: 2px; }
article a:visited { color: var(--visited); }
strong { font-weight: 650; }
code {
  font-family: var(--mono); font-size: .86em; background: var(--surface);
  border: 1px solid var(--line); border-radius: 2px; padding: .05em .3em;
}
pre {
  font-family: var(--mono); font-size: .82rem; line-height: 1.6;
  background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
  padding: .9rem 1rem; margin: 0 0 1.4rem; overflow-x: auto;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
blockquote {
  margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--rule);
  color: var(--muted);
}

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 0 0 1.5rem; }
table { border-collapse: collapse; font-size: .88rem; min-width: 26rem; }
th, td { text-align: left; padding: .42rem .9rem .42rem 0; border-bottom: 1px solid var(--line); }
th {
  font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); font-weight: 600; border-bottom-color: var(--rule);
}
td:not(:first-child) { font-family: var(--mono); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ---------- figures ---------- */
.fig { margin: 1.9rem 0 1.8rem; }
.fig svg { width: 100%; height: auto; display: block; }
.fig figcaption {
  font-size: .82rem; color: var(--muted); line-height: 1.5;
  margin-top: .7rem; max-width: var(--measure);
  padding-left: .8rem; border-left: 2px solid var(--rule);
}
.fig .box { fill: var(--surface); stroke: var(--rule); stroke-width: 1; }
.fig .lbl { fill: var(--ink); font-family: var(--mono); font-size: 12px; }
/* 单一 class，不用复合选择器——SVG 里的样式越简单越不容易在边缘环境失效 */
.fig .cap { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.fig .capem { fill: var(--accent); font-family: var(--mono); font-size: 11px; }
.fig .axt { fill: var(--faint); font-family: var(--mono); font-size: 10px; }
.fig .arw { stroke: var(--muted); stroke-width: 1.2; }
.fig .arwh { fill: var(--muted); }
.fig .brk { stroke: var(--accent); stroke-width: 1.2; fill: none; }
.fig .ax { stroke: var(--rule); stroke-width: 1; }
.fig .bar { fill: var(--accent); opacity: .55; }
.fig .barhot { fill: var(--flag); opacity: .72; }
.fig .p99 { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 3; }
.fig .warn { stroke: var(--flag); stroke-width: 1.2; }
.fig .warnt { fill: var(--flag); font-family: var(--mono); font-size: 11px; }

/* ---------- footnotes ---------- */
.fnref { font-family: var(--mono); font-size: .7em; }
.fnref a { text-decoration: none; padding: 0 .1em; }
.footnotes { margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.footnotes h2 {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--faint); font-weight: 600; margin: 0 0 .9rem;
}
.footnotes ol { margin: 0; padding-left: 1.2rem; }
.footnotes li { font-size: .92rem; color: var(--muted); line-height: 1.55; margin-bottom: .6rem; }
.fnback { text-decoration: none; font-family: var(--mono); }

/* ---------- post nav ---------- */
.postnav {
  display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 3.2rem;
  padding-top: 1.3rem; border-top: 1px solid var(--line);
}
.postnav a {
  flex: 1 1 14rem; text-decoration: none; font-size: .95rem; font-weight: 600;
  color: var(--ink); line-height: 1.35;
}
.postnav a:hover { color: var(--accent); text-decoration: none; }
.postnav a.next { text-align: right; }
.postnav span {
  display: block; font-family: var(--mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint); font-weight: 600; margin-bottom: .3rem;
}

/* ---------- archive ---------- */
.page-title {
  font-size: clamp(1.5rem, 4vw, 1.85rem); letter-spacing: -.02em; font-weight: 680;
  margin: 0 0 .6rem;
}
.count { margin: 0 0 2.6rem; }
.year { margin-bottom: 2.4rem; }
.year h2 {
  font-family: var(--mono); font-size: .78rem; font-weight: 600; letter-spacing: .08em;
  color: var(--faint); margin: 0 0 .5rem; padding-bottom: .45rem;
  border-bottom: 1px solid var(--rule);
}
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li {
  display: grid; grid-template-columns: 4.6rem 1fr auto; gap: .9rem; align-items: baseline;
  padding: .58rem 0; border-bottom: 1px solid var(--line);
}
ul.rows a { color: var(--ink); font-weight: 550; }
ul.rows a:hover { color: var(--accent); text-decoration: none; }
ul.rows a:visited { color: var(--visited); }
@media (max-width: 34rem) {
  ul.rows li { grid-template-columns: 1fr auto; }
  ul.rows time { grid-column: 1 / -1; }
}

/* ---------- footer ---------- */
.colo { border-top: 1px solid var(--line); margin-top: 4rem; }
.colo .wrap {
  padding-top: 1.5rem; padding-bottom: 2.6rem;
  display: flex; flex-wrap: wrap; gap: .35rem 1.3rem; align-items: baseline;
  font-family: var(--mono); font-size: .74rem; color: var(--faint);
}
.colo a { color: var(--muted); }
.colo a:hover { color: var(--ink); text-decoration: none; }
.colo span { margin-right: auto; }
