:root {
  --paper: #f5ecdc;
  --paper-warm: #f9f1e5;
  --paper-shadow: #e5d5bb;
  --ink: #2f2015;
  --muted-ink: #6b563f;
  --rule: #d3bc95;
  --accent: #7a4925;
  --accent-strong: #5a3217;
  --chalk: #2f2826;
  --chalk-ink: #f4dbb0;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 252, 244, 0.75) 0%, transparent 32%),
    radial-gradient(circle at 88% 90%, rgba(228, 207, 171, 0.72) 0%, transparent 36%),
    linear-gradient(180deg, #f0debf 0%, #f4e8d2 56%, #ead9bf 100%);
  font-family: "Alegreya", Georgia, serif;
  line-height: 1.65;
}

.page {
  max-width: 900px;
  margin: 2.1rem auto;
  padding: 2rem clamp(1.1rem, 3.6vw, 2.6rem);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(112, 80, 42, 0.04) 0 1px,
      transparent 1px 4px
    ),
    linear-gradient(180deg, rgba(255, 251, 243, 0.94) 0%, rgba(251, 243, 230, 0.9) 100%);
  border: 1px solid var(--rule);
  box-shadow: 0 15px 32px rgba(58, 33, 11, 0.12);
}

h1,
h2,
h3 {
  font-family: "Merienda", "Times New Roman", serif;
  color: #2e1c11;
}

.cover {
  margin-bottom: 2rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--rule);
}

.cover h1 {
  margin: 0;
  font-size: clamp(2rem, 4.8vw, 3.3rem);
  line-height: 1.07;
}

.subtitle {
  margin: 0.65rem 0 0;
  color: var(--muted-ink);
  font-size: clamp(1.08rem, 2.2vw, 1.26rem);
  max-width: 58ch;
}

.social-links {
  margin-top: 1.15rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.social-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(122, 73, 37, 0.08);
  padding: 0.35rem 0.72rem;
  color: var(--accent-strong);
  text-decoration: none;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.social-button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.social-button:hover,
.social-button:focus-visible {
  background: rgba(122, 73, 37, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.home-intro {
  margin-bottom: 1.25rem;
  color: #593f2e;
}

h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.4rem, 3.3vw, 2rem);
}

.section-note {
  margin: 0.1rem 0 0;
  color: var(--muted-ink);
}

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

.post-list li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}

.post-list time {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted-ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.post-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
}

.post-list a:hover,
.post-list a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  outline: none;
}

.post-list p {
  margin: 0.3rem 0 0;
  color: #4d3b2a;
}

.blank-state {
  border-top: 1px solid var(--rule);
  margin-top: 1rem;
  padding-top: 1rem;
  font-style: italic;
  color: var(--muted-ink);
}

.site-footer {
  margin-top: 2rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  justify-content: space-between;
  align-items: baseline;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--muted-ink);
}

.site-footer p {
  margin: 0;
}

.footer-edited a {
  color: var(--accent-strong);
  text-decoration-color: rgba(90, 50, 23, 0.35);
}

.footer-edited a:hover,
.footer-edited a:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
  outline: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--accent);
  text-decoration-color: #b8844f;
  font-weight: 700;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent-strong);
  outline: none;
}

.post-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4.9vw, 3.2rem);
  line-height: 1.08;
  max-width: 24ch;
}

.post-date {
  margin: 0.6rem 0 0;
  color: var(--muted-ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: #835a37;
  font-size: 0.92rem;
  font-family: "Merienda", "Times New Roman", serif;
}

.read-time {
  margin: 0.55rem 0 0;
  display: inline-block;
  border-radius: 999px;
  border: 1px solid rgba(122, 73, 37, 0.32);
  background: rgba(122, 73, 37, 0.1);
  color: #6f4323;
  font-size: 0.84rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
  padding: 0.2rem 0.58rem;
}

.lede {
  margin: 0.78rem 0 0;
  font-size: clamp(1.03rem, 2vw, 1.16rem);
  color: #3d291b;
  max-width: 65ch;
}

.post-content {
  font-size: 1.13rem;
}

.post-content h2 {
  margin: 2.05rem 0 0.62rem;
  line-height: 1.12;
  scroll-margin-top: 1rem;
}

.post-content h2:first-of-type {
  margin-top: 1.35rem;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote {
  max-width: 70ch;
}

.post-content code,
.post-content pre {
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.post-content :not(pre) > code {
  font-size: 0.82em;
  border: 1px solid rgba(122, 73, 37, 0.22);
  border-radius: 0.3rem;
  padding: 0.03rem 0.25rem;
  background: rgba(110, 70, 41, 0.08);
}

.post-content pre {
  margin: 0.9rem 0 0;
  border: 1px solid rgba(120, 83, 48, 0.28);
  background: rgba(245, 236, 219, 0.82);
  border-radius: 0.62rem;
  padding: 0.75rem 0.82rem;
  overflow-x: auto;
  max-width: 100%;
}

.post-content img {
  max-width: 100%;
  height: auto;
}

.experiment-entry .post-content > ul:first-child {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-left: 1.1rem;
  line-height: 1.58;
}

.diagram-card {
  margin: 1.1rem 0;
  background: linear-gradient(180deg, var(--paper-warm) 0%, #f0ddbf 100%);
  border: 2px solid var(--rule);
  border-radius: 0.8rem;
  padding: 0.72rem;
}

.diagram-card img {
  border: 2px solid #d4ba91;
  border-radius: 0.58rem;
  background: #f8ecd8;
}

.diagram-card figcaption {
  margin-top: 0.52rem;
  color: #654329;
  font-size: 0.95rem;
}

.chalk-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.chalk-panel {
  margin-top: 0.9rem;
  background:
    radial-gradient(circle at 17% 16%, rgba(255, 255, 255, 0.07), transparent 38%),
    repeating-linear-gradient(
      125deg,
      rgba(255, 255, 255, 0.03) 0 2px,
      transparent 2px 6px
    ),
    linear-gradient(180deg, #3f3530 0%, var(--chalk) 100%);
  color: var(--chalk-ink);
  border: 2px solid #6f563f;
  border-radius: 0.8rem;
  padding: 0.84rem;
  box-shadow: inset 0 0 0 1px rgba(241, 207, 157, 0.18), 0 7px 14px rgba(25, 13, 5, 0.2);
}

.chalk-panel h3 {
  margin: 0;
  color: #ffe4b8;
  font-size: 1.17rem;
}

.chalk-panel p,
.chalk-panel li,
.chalk-panel td,
.chalk-panel th,
.chalk-panel span,
.chalk-panel em {
  color: #f4ddb7;
}

.chalk-panel ul {
  margin: 0.6rem 0 0;
  padding-left: 1rem;
}

.bar-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.bar-list li {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 0.45rem;
}

.bar-list span,
.bar-list em {
  font-size: 0.92rem;
}

.bar-list em {
  font-style: normal;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(11, 8, 5, 0.42);
  border: 1px solid rgba(255, 226, 182, 0.16);
  overflow: hidden;
}

.bar {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  border-radius: 999px;
}

.bar.pos {
  background: linear-gradient(90deg, #d97f48 0%, #f0b16c 100%);
}

.bar.neg {
  background: linear-gradient(90deg, #8ebf8c 0%, #bee0a1 100%);
}

.token-growth-panel h3 {
  margin-bottom: 0.2rem;
}

.token-legend {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.token-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  width: 0.9rem;
  height: 0.5rem;
  border-radius: 999px;
  display: inline-block;
}

.legend-swatch.iterative {
  background: linear-gradient(90deg, #d97f48 0%, #f0b16c 100%);
}

.legend-swatch.fulltext {
  background: linear-gradient(90deg, #8bb2d8 0%, #b8d0ec 100%);
}

.legend-swatch.fullbudget {
  background: linear-gradient(90deg, #bf7440 0%, #e29a63 100%);
}

.legend-swatch.earlystop {
  background: linear-gradient(90deg, #7fae78 0%, #add29d 100%);
}

.token-growth-list {
  margin: 0.72rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.58rem;
}

.token-growth-list > li {
  border-top: 1px solid rgba(255, 226, 182, 0.24);
  padding-top: 0.55rem;
}

.token-growth-list > li > strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.token-row {
  display: grid;
  grid-template-columns: 108px 1fr auto;
  gap: 0.42rem;
  align-items: center;
  margin-top: 0.26rem;
}

.token-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.token-row .bar.iterative {
  background: linear-gradient(90deg, #d97f48 0%, #f0b16c 100%);
}

.token-row .bar.fulltext {
  background: linear-gradient(90deg, #8bb2d8 0%, #b8d0ec 100%);
}

.token-row .bar.fullbudget {
  background: linear-gradient(90deg, #bf7440 0%, #e29a63 100%);
}

.token-row .bar.earlystop {
  background: linear-gradient(90deg, #7fae78 0%, #add29d 100%);
}

.token-value {
  font-size: 0.83rem;
  font-style: normal;
  font-weight: 700;
}

.token-row-note {
  margin: 0.28rem 0 0;
  font-size: 0.82rem;
  color: #f2ddb7;
}

.panel-foot {
  margin: 0.65rem 0 0;
  font-size: 0.95rem;
}

.chalk-table {
  width: 100%;
  margin-top: 0.74rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  border: 1px solid rgba(255, 226, 182, 0.26);
  border-radius: 0.62rem;
  overflow: hidden;
  background: rgba(19, 13, 9, 0.3);
}

.chalk-table th,
.chalk-table td {
  border-bottom: 1px solid rgba(255, 226, 182, 0.2);
  padding: 0.58rem 0.64rem;
  text-align: left;
}

.chalk-table th + th,
.chalk-table td + td {
  border-left: 1px solid rgba(255, 226, 182, 0.14);
}

.chalk-table th {
  color: #fff3d5;
  font-weight: 700;
  background: rgba(255, 226, 182, 0.13);
}

.chalk-table tbody td {
  color: #f7e3c2;
}

.chalk-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}

.chalk-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 860px) {
  .page {
    margin: 1rem;
    padding: 1.3rem 1.1rem;
  }

  .chalk-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .post-content {
    font-size: 1.05rem;
  }

  .site-footer {
    font-size: 0.74rem;
  }

  .post-content h2 {
    margin-top: 1.75rem;
  }

  .bar-list li {
    grid-template-columns: 70px 1fr auto;
  }

  .token-row {
    grid-template-columns: 82px 1fr auto;
  }

  .bar-list span,
  .bar-list em,
  .token-label,
  .token-value,
  .chalk-table {
    font-size: 0.83rem;
  }
}
