:root {
  --bg: #fbfbf9;
  --panel: #f4f4f1;
  --paper: #ffffff;
  --ink: #1a1a18;
  --muted: #5f5f5b;
  --faint: #9b9b95;
  --rule: #e6e6e1;
  --accent: #be503f;
  --accent-deep: #9c3f30;
  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  z-index: 100;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; }

.site-head {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.wordmark .dot { color: var(--accent); }
.site-nav {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.site-nav a { color: var(--muted); transition: color .16s ease; }
.site-nav a:hover { color: var(--accent); }

.reader {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 28px 110px;
  display: grid;
  grid-template-columns: 250px minmax(0, 820px);
  gap: 64px;
  align-items: start;
}

.archive {
  position: sticky;
  top: 32px;
  padding-top: 26px;
}
.archive-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 4px;
}
.archive-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
}
.archive-count {
  font-family: var(--mono);
  color: var(--faint);
  font-size: 11px;
  letter-spacing: .1em;
}
.post-list { list-style: none; padding: 0; margin: 0; }
.post-link {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 10px;
  padding: 16px 4px 16px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  transition: color .16s ease, padding-left .16s ease;
}
.post-link:hover { color: var(--ink); padding-left: 4px; }
.post-link.active { color: var(--ink); }
.post-link.active .post-no { color: var(--accent); }
.post-link.active .post-name { font-weight: 700; }
.post-no {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--faint);
  padding-top: 3px;
}
.post-name {
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.22;
  letter-spacing: -.01em;
}
.post-kind {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.35;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 5px;
}
.archive-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--faint);
  margin-top: 18px;
}

.mobile-index { display: none; }

.article-shell { min-width: 0; }
.post { display: none; }
.post.active { display: block; animation: articleIn .22s ease-out; }
@keyframes articleIn { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.post-head { padding: 22px 0 0; }
.eyebrow {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.eyebrow .sep { flex: 1; height: 1px; background: var(--rule); }
h1.title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(42px, 6.5vw, 68px);
  line-height: 1.05;
  letter-spacing: -.035em;
  margin: 0 0 24px;
  max-width: 850px;
}
h1.title em { font-style: normal; color: var(--accent); }
.byline {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0;
  text-transform: uppercase;
}
.byline .name { color: var(--ink); font-weight: 500; }
.head-rule { height: 1px; background: var(--rule); margin: 40px 0 42px; }

.post-figure { margin: 0 0 36px; text-align: center; }
.post-figure img { display: block; width: 100%; height: auto; border-radius: 4px; }

.body { counter-reset: sec; }
.lede {
  font-weight: 500;
  font-size: clamp(22px, 3.2vw, 27px);
  line-height: 1.36;
  letter-spacing: -.01em;
  margin: 0 0 36px;
}
p { margin: 0 0 24px; }
.body h2 {
  counter-increment: sec;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 4.2vw, 38px);
  line-height: 1.12;
  letter-spacing: -.022em;
  margin: 58px 0 18px;
  padding-top: 30px;
  position: relative;
}
.body h2::before {
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  top: 2px;
  left: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--accent);
}
h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -.012em;
  margin: 34px 0 12px;
}
strong { font-weight: 600; }
blockquote {
  margin: 32px 0;
  padding: 22px 24px;
  background: var(--panel);
  border-left: 2px solid var(--accent);
}
blockquote p { font-weight: 500; font-size: 21px; line-height: 1.45; margin: 0 0 12px; }
blockquote p:last-child { margin-bottom: 0; }
blockquote .attr { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); display: block; }
.body ul, .body ol { margin: 0 0 26px; padding-left: 1.35em; }
.body li { margin: 0 0 9px; padding-left: .2em; }
.body li::marker { color: var(--accent); font-family: var(--mono); }
.body p a, .body li a, .references a {
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px solid rgba(190,80,63,.34);
  transition: border-color .16s ease, color .16s ease;
}
.body p a:hover, .body li a:hover, .references a:hover { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }

.formula {
  margin: 30px 0;
  padding: 21px 22px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: clamp(14px, 2.2vw, 17px);
  line-height: 1.65;
  overflow-x: auto;
  border-radius: 2px;
}
.formula .accent { color: #e98b7c; }
.center-formula { text-align: center; font-size: clamp(13px, 2vw, 17px); }
.layer-grid, .role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin: 28px 0 34px;
}
.layer, .role-card { background: var(--panel); border-top: 2px solid var(--accent); padding: 18px 18px 16px; }
.layer .tag, .role-card .tag, .contact-panel .tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 7px;
}
.layer h3, .role-card h3 { margin: 0 0 7px; font-size: 20px; }
.layer p, .role-card p { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 0; }
.stack { margin: 30px 0; border: 1px solid var(--rule); background: var(--paper); }
.stack-row { display: grid; grid-template-columns: 172px 1fr; border-bottom: 1px solid var(--rule); }
.stack-row:last-child { border-bottom: 0; }
.stack-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); padding: 15px 17px; background: var(--panel); }
.stack-copy { font-size: 16px; line-height: 1.45; color: var(--muted); padding: 14px 17px; }
.sequence { list-style: none; counter-reset: step; padding: 0 !important; margin: 28px 0 34px !important; }
.sequence li { counter-increment: step; display: grid; grid-template-columns: 42px 1fr; gap: 14px; padding: 17px 0; margin: 0; border-top: 1px solid var(--rule); }
.sequence li:last-child { border-bottom: 1px solid var(--rule); }
.sequence li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--accent); padding-top: 4px; }
.sequence strong { display: block; font-family: var(--display); font-size: 20px; line-height: 1.25; margin-bottom: 4px; }
.sequence span { display: block; color: var(--muted); font-size: 16px; line-height: 1.45; }
.references { font-size: 15px; line-height: 1.48; color: var(--muted); padding-left: 1.5em; }
.references li { margin-bottom: 12px; }
.endmark { font-family: var(--mono); color: var(--accent); font-size: 14px; margin-top: 42px; letter-spacing: .3em; }

.deal-table { border: 1px solid var(--rule); margin: 28px 0 34px; background: var(--paper); }
.deal-row { display: grid; grid-template-columns: 1.4fr .8fr .8fr; border-bottom: 1px solid var(--rule); }
.deal-row:last-child { border-bottom: 0; }
.deal-row span { padding: 13px 15px; font-size: 16px; }
.deal-row span + span { border-left: 1px solid var(--rule); font-family: var(--mono); font-size: 14px; }
.deal-head { background: var(--panel); color: var(--muted); }
.deal-head span { font-family: var(--mono) !important; font-size: 10.5px !important; letter-spacing: .08em; text-transform: uppercase; }
.contact-panel { margin: 34px 0 12px; padding: 24px; background: var(--ink); color: var(--bg); }
.contact-panel .tag { color: #e98b7c; }
.contact-link { display: inline-block; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 40px); line-height: 1.1; letter-spacing: -.025em; color: var(--bg); margin: 5px 0 14px; border-bottom: 2px solid var(--accent); }
.contact-link:hover { color: #fff; }
.contact-panel p { margin: 0; color: #cfcfc8; font-size: 16px; }

.post-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--rule);
  margin-top: 62px;
  padding-top: 22px;
}
.post-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.post-nav a, .copy-link {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.post-nav a:hover, .copy-link:hover { color: var(--ink); border-color: #c8c8c2; background: var(--panel); }
.copy-link.copied { color: var(--accent); border-color: var(--accent); }

footer {
  border-top: 1px solid var(--rule);
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 56px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}
footer .fm { font-family: var(--display); font-weight: 800; text-transform: none; letter-spacing: -.02em; color: var(--ink); font-size: 16px; }
footer .fm .dot { color: var(--accent); }
footer a { color: var(--faint); transition: color .16s ease; }
footer a:hover { color: var(--accent); }
footer .dotsep { color: var(--rule); }

@media (max-width: 900px) {
  body { font-size: 18px; }
  .site-head { padding-bottom: 8px; }
  .reader { display: block; padding-top: 8px; }
  .archive { display: none; }
  .mobile-index {
    display: block;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin: 10px 0 30px;
  }
  .mobile-index summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 13px 0;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .mobile-index summary::-webkit-details-marker { display: none; }
  .mobile-index summary::after { content: '+'; color: var(--accent); font-size: 16px; }
  .mobile-index[open] summary::after { content: '−'; }
  .mobile-index .post-link { grid-template-columns: 29px 1fr; padding: 13px 0; }
  .mobile-index .post-list { padding-bottom: 5px; }
  .post-head { padding-top: 14px; }
}

@media (max-width: 700px) {
  .site-head { align-items: flex-start; }
  .site-nav { justify-content: flex-end; gap: 10px 14px; }
  .reader { padding-left: 20px; padding-right: 20px; }
  h1.title { font-size: clamp(40px, 12vw, 58px); }
  .layer-grid, .role-grid { grid-template-columns: 1fr; }
  .stack-row { grid-template-columns: 1fr; }
  .stack-label { padding-bottom: 7px; }
  .stack-copy { padding-top: 4px; }
  .deal-row { grid-template-columns: 1.25fr .75fr .75fr; }
  .deal-row span { padding: 11px 8px; font-size: 14px; }
  .deal-row span + span { font-size: 12px; }
  .post-tools { align-items: flex-start; flex-direction: column; }
}

@media print {
  body::before, .site-head, .archive, .mobile-index, footer, .post-tools { display: none !important; }
  .reader { display: block; max-width: 760px; padding: 0; }
  .post { display: none !important; }
  .post.active { display: block !important; animation: none; }
  a { color: var(--ink); }
}
/* extra: standalone-page tweaks for individual post files */
