/* immerse — letterpress field guide
   paper & ink: warm stock, ink black, seal vermilion (朱砂). no cards, no glow, no dark mode. */

:root {
  --paper: #f4efe3;
  --paper-hi: #fbf8ef;
  --ink: #221e17;
  --ink-2: #464035;
  --ink-3: #6f6757;
  --ink-4: #978d79;
  --rule: #d9d1bd;
  --rule-2: #c3b89d;
  --seal: #b03a24;
  --seal-soft: rgba(176,58,36,0.07);
  --serif-display: 'Fraunces', Georgia, serif;
  --serif-body: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--serif-body);
  font-size: 17px;
  line-height: 1.62;
  font-optical-sizing: auto;
}

/* faint stock grain */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container { max-width: 764px; margin: 0 auto; padding: 0 24px; }

::selection { background: var(--seal); color: var(--paper-hi); }

/* ---------- masthead ---------- */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 3px double var(--rule-2);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 62px; padding-top: 7px; padding-bottom: 7px;
  gap: 14px; flex-wrap: wrap;
}
.logo {
  font-family: var(--serif-display);
  font-size: 21px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 11px;
}
.logo .dot { display: none; }
.logo .zh {
  display: inline-block;
  background: var(--seal);
  color: #f8f3e7;
  font-family: var(--serif-body);
  font-size: 12px; font-weight: 500;
  padding: 3px 4px 2px;
  letter-spacing: 3px;
  line-height: 1.25;
  box-shadow: 1.5px 1.5px 0 rgba(34,30,23,0.28);
}
.nav-links { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--mono);
  font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-3);
  text-decoration: none; padding: 5px 9px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-links a:hover { color: var(--seal); }
.nav-links a.active { color: var(--ink); border-bottom-color: var(--seal); }

/* ---------- hero ---------- */
.hero { padding: 80px 0 52px; text-align: left; }
.hero-kicker {
  display: block;
  font-family: var(--mono); font-size: 11px;
  color: var(--seal); letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 26px;
}
.hero h1 {
  font-family: var(--serif-display);
  font-size: clamp(31px, 4.6vw, 48px);
  font-weight: 600; line-height: 1.14; letter-spacing: -0.015em;
  color: var(--ink); max-width: 720px; margin: 0 0 26px;
}
.hero h1 .glow { color: var(--seal); font-style: italic; }
.hero .sub {
  font-size: 18.5px; line-height: 1.65; color: var(--ink-2);
  max-width: 640px; margin: 0 0 36px;
}
.hero .sub::first-letter {
  font-family: var(--serif-display);
  font-size: 3.3em; font-weight: 600;
  float: left; line-height: 0.82;
  padding: 6px 10px 0 0;
  color: var(--seal);
}
.hero-cta { display: flex; gap: 14px; justify-content: flex-start; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.09em;
  text-decoration: none;
  padding: 11px 22px; border-radius: 0; transition: all .15s;
}
.btn-primary { background: var(--ink); color: var(--paper-hi); border: 1px solid var(--ink); }
.btn-primary:hover { background: var(--seal); border-color: var(--seal); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule-2); }
.btn-ghost:hover { border-color: var(--seal); color: var(--seal); }

/* ---------- page head ---------- */
.page-head { padding: 64px 0 38px; border-bottom: 1px solid var(--rule); }
.page-head .kicker {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--seal);
  margin-bottom: 16px;
}
.page-head h1 {
  font-family: var(--serif-display);
  font-size: clamp(27px, 4vw, 40px); font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.14; color: var(--ink);
  max-width: 680px; margin-bottom: 18px;
}
.page-head .lede { font-size: 18px; color: var(--ink-2); max-width: 640px; }

/* ---------- sections ---------- */
section { padding: 50px 0; }
section.tight { padding: 32px 0; }
.sec-label {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--seal);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
}
.sec-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
h2 {
  font-family: var(--serif-display);
  font-size: clamp(23px, 3vw, 30px); font-weight: 600;
  letter-spacing: -0.012em; color: var(--ink); line-height: 1.18;
  margin-bottom: 18px;
}
h3 {
  font-family: var(--serif-display);
  font-size: 20px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--ink); margin-bottom: 10px;
}
h4 { font-family: var(--serif-display); font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
p { margin-bottom: 15px; color: var(--ink-2); }
p.dim, li.dim { color: var(--ink-3); }
strong, b { color: var(--ink); font-weight: 600; }
em { color: var(--ink); font-style: italic; }
a.inline { color: var(--seal); text-decoration: none; border-bottom: 1px solid rgba(176,58,36,0.4); }
a.inline:hover { border-bottom-color: var(--seal); }

.divider { border: none; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- entries: what used to be cards are now prose blocks on rules ---------- */
.grid { display: block; }
.grid.c2, .grid.c3, .grid.c4 { display: block; }

.card {
  background: transparent;
  border: none; border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 22px 0 24px;
  transition: none;
}
.grid > .card:first-child, .entries > .card:first-child { border-top: none; padding-top: 6px; }
.card:hover { background: transparent; }
.card .num {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--seal); letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 10px; display: block;
}
.card p:last-child { margin-bottom: 0; }
.card p { font-size: 16.5px; color: var(--ink-2); }

/* index links */
.card-link {
  display: block; text-decoration: none; color: inherit;
  background: transparent;
  border: none; border-top: 1px solid var(--rule);
  border-radius: 0; padding: 20px 0;
  transition: none;
}
.grid > .card-link:first-child { border-top: none; padding-top: 4px; }
.card-link:hover h3 { color: var(--seal); }
.card-link h3 {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--serif-display); font-size: 20px; font-weight: 600; color: var(--ink);
  margin-bottom: 6px; transition: color .12s;
}
.card-link h3 .arrow { color: var(--seal); font-size: 16px; transition: transform .15s; }
.card-link:hover h3 .arrow { transform: translateX(4px); }
.card-link p { font-size: 15.5px; color: var(--ink-3); margin-bottom: 0; max-width: 620px; }

/* ---------- stat strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 3px double var(--rule-2);
  border-bottom: 3px double var(--rule-2);
}
.stat { padding: 24px 18px; border-left: 1px solid var(--rule); text-align: left; }
.stat:first-child { border-left: none; padding-left: 0; }
.stat .v {
  font-family: var(--serif-display);
  font-size: 29px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stat .v span { color: var(--seal); }
.stat .k { font-size: 13px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }

/* ---------- stamp labels (former pills) ---------- */
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--seal);
  border: 1.5px solid var(--seal);
  padding: 3px 9px 2px;
  margin: 0 8px 14px 0;
  background: transparent;
  transform: rotate(-1deg);
}
.pill.violet { color: var(--ink); border-color: var(--ink); transform: rotate(0.8deg); }
.pill.green { color: var(--ink-3); border-color: var(--rule-2); transform: rotate(-0.6deg); }
.pill.amber { color: var(--seal); border-color: rgba(176,58,36,0.55); transform: rotate(1.2deg); }

/* ---------- quotes ---------- */
blockquote {
  margin: 36px 0; padding-left: 36px; position: relative;
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: 21px; font-weight: 400; font-style: italic; line-height: 1.45;
  letter-spacing: -0.005em;
}
blockquote::before {
  content: '“';
  font-size: 66px; line-height: 0; color: var(--seal);
  position: absolute; left: -4px; top: 36px;
  font-style: normal;
}
blockquote .attr {
  display: block; margin-top: 14px;
  font-family: var(--mono); font-style: normal; font-size: 11px;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3);
}

/* ---------- margin notes (former callouts) ---------- */
.callout {
  display: block;
  margin: 28px 0; padding: 2px 0 2px 22px;
  background: transparent; border: none;
  border-left: 3px solid var(--seal);
  border-radius: 0;
}
.callout .ico { display: none; }
.callout p { margin: 0; font-size: 16px; color: var(--ink-2); font-style: italic; }
.callout p strong { font-style: normal; }
.callout.warn { border-left-color: var(--seal); }
.callout.good { border-left-color: var(--ink); }

/* ---------- lists ---------- */
ul.clean, ol.clean { list-style: none; margin: 14px 0 20px; }
ul.clean li, ol.clean li {
  position: relative; padding-left: 28px; margin-bottom: 12px;
  font-size: 16.5px; color: var(--ink-2);
}
ul.clean li::before {
  content: '—'; position: absolute; left: 0; top: 0;
  color: var(--seal); font-weight: 500;
}
ol.clean { counter-reset: item; }
ol.clean li { counter-increment: item; }
ol.clean li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute; left: 0; top: 2px;
  font-family: var(--mono); font-size: 11px;
  color: var(--seal); letter-spacing: 0.02em;
}
ul.check li::before { content: '✓'; color: var(--seal); font-size: 14px; font-weight: 700; }
ul.cross li::before { content: '✕'; color: var(--seal); font-size: 13px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 24px 0; border-top: 3px double var(--rule-2); border-bottom: 3px double var(--rule-2); border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-family: var(--serif-body); }
th {
  text-align: left; padding: 12px 14px; color: var(--ink);
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap; background: transparent;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--rule); color: var(--ink-2); vertical-align: top; line-height: 1.55; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(34,30,23,0.02); }
td.mono, th.mono { font-family: var(--mono); font-size: 12.5px; }
td b { color: var(--ink); font-weight: 600; }

/* ---------- i+1 figure ---------- */
.iplus {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  padding: 46px 12px 40px; flex-wrap: wrap;
}
.ip-node { text-align: center; }
.ip-circle {
  width: 110px; height: 110px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--serif-display); margin: 0 auto 12px;
}
.ip-circle .big { font-size: 26px; font-weight: 600; color: var(--ink); }
.ip-circle .lbl { font-family: var(--mono); font-size: 8.5px; color: var(--ink-3); letter-spacing: 0.1em; margin-top: 5px; }
.ip-i .ip-circle { border: 1.5px solid var(--ink); background: transparent; }
.ip-plus { font-family: var(--serif-display); font-size: 27px; color: var(--ink-4); font-weight: 400; }
.ip-one .ip-circle { border: 1.5px solid var(--seal); background: var(--seal-soft); box-shadow: none; }
.ip-one .ip-circle .big { color: var(--seal); }
.ip-caption { font-size: 13px; color: var(--ink-3); max-width: 140px; margin: 0 auto; line-height: 1.5; font-style: italic; }

/* ---------- timeline ---------- */
.timeline { position: relative; margin: 30px 0 8px; padding-left: 30px; }
.timeline::before {
  content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px;
  width: 1px; background: var(--rule-2);
}
.tl-item { position: relative; padding-bottom: 32px; }
.tl-item::before {
  content: ''; position: absolute; left: -30px; top: 7px;
  width: 9px; height: 9px; border-radius: 0;
  background: var(--seal); border: none; box-shadow: none;
}
.tl-item .yr {
  font-family: var(--mono); font-size: 11px;
  color: var(--seal); margin-bottom: 5px; letter-spacing: 0.12em;
}
.tl-item h4 { margin-bottom: 5px; }
.tl-item p { font-size: 15.5px; color: var(--ink-2); margin-bottom: 0; max-width: 620px; }

/* ---------- day bar ---------- */
.daybar { display: flex; height: 44px; border-radius: 0; overflow: hidden; border: 1px solid var(--ink); margin: 18px 0 12px; font-size: 10px; }
.daybar div {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden;
  border-left: 1px solid var(--ink);
}
.daybar div:first-child { border-left: none; }
.db-sleep { background: var(--paper); color: var(--ink-4) !important; flex: 8; }
.db-passive { background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(34,30,23,0.13) 4px, rgba(34,30,23,0.13) 5px); color: var(--ink-2); flex: 2.5; }
.db-active { background: var(--seal); color: #f8f3e7; flex: 1.5; }
.db-srs { background: var(--ink); color: var(--paper-hi); flex: 0.75; }
.db-life { background: var(--paper-hi); color: var(--ink-3) !important; flex: 3.25; }
.daybar-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); }
.daybar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.daybar-legend i { width: 11px; height: 11px; border-radius: 0; display: inline-block; border: 1px solid var(--ink); }

/* ---------- references ---------- */
.ref-list { list-style: none; margin-top: 20px; counter-reset: ref; }
.ref-list li {
  padding: 16px 0 16px 44px; border-bottom: 1px solid var(--rule);
  font-size: 15px; color: var(--ink-3);
  counter-increment: ref; position: relative;
}
.ref-list li::before {
  content: counter(ref, decimal-leading-zero);
  position: absolute; left: 0; top: 18px;
  font-family: var(--mono); font-size: 11px; color: var(--seal);
}
.ref-list li:last-child { border-bottom: none; }
.ref-list a { color: var(--ink); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--rule-2); }
.ref-list a:hover { color: var(--seal); border-bottom-color: var(--seal); }
.ref-list .tagline { display: block; margin-top: 5px; font-size: 14px; color: var(--ink-3); font-style: italic; }

/* ---------- colophon ---------- */
footer {
  border-top: 3px double var(--rule-2);
  margin-top: 64px; padding: 34px 0 48px;
}
.foot-inner { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 14px; }
.foot-inner p { font-size: 14px; color: var(--ink-3); margin: 0; font-style: italic; }
.foot-inner .wordmark {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--ink-3); text-transform: uppercase;
}
.foot-inner .wordmark b { color: var(--seal); font-weight: 500; }

/* ---------- misc ---------- */
.kicker-mono { font-family: var(--mono); font-size: 12px; color: var(--seal); letter-spacing: 0.08em; }

.toc { columns: 1; list-style: none; margin: 22px 0; max-width: 640px; }
.toc li { margin-bottom: 0; border-bottom: 1px dotted var(--rule-2); break-inside: avoid; }
.toc a {
  color: var(--ink-2); text-decoration: none;
  font-size: 16px; font-family: var(--serif-body); font-weight: 400;
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 0;
}
.toc a:hover { color: var(--seal); }
.toc .n { font-family: var(--mono); color: var(--seal); font-size: 11px; min-width: 20px; }

.anchor { scroll-margin-top: 88px; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; }
  .stat:nth-child(2) { border-left: 1px solid var(--rule); padding-left: 18px; border-top: none; }
  .stat:nth-child(4) { border-left: 1px solid var(--rule); padding-left: 18px; }
  .hero { padding: 56px 0 40px; }
  .nav-inner { justify-content: center; }
  section { padding: 40px 0; }
  .iplus { gap: 12px; }
  .ip-circle { width: 92px; height: 92px; }
}
