/* ============================================================
   style.css — LeesBlog / "the human in progress"
   Direction C ("Ledger") · Space Mono · light + dark
   No framework, no build step. All design tokens are CSS
   custom properties on .site / .site.dark so they're trivial
   to lift into Tailwind/SCSS/whatever later.
   ============================================================ */

html,
body {
  margin: 0;
  padding: 0;
}

/* ---------- design tokens ---------- */
.site {
  --paper: #faf8f5;
  --ink: #2b2722;
  --faint: rgba(43, 39, 34, 0.55);
  --whisper: rgba(43, 39, 34, 0.38);
  --hair: rgba(43, 39, 34, 0.14);
  --panel: rgba(43, 39, 34, 0.045);
  --accent: oklch(0.62 0.14 70);

  /* per-category hues — matched chroma & lightness, varied hue */
  --cat-programming: oklch(0.55 0.11 250);
  --cat-terminal: oklch(0.55 0.11 150);
  --cat-homelab: oklch(0.55 0.11 300);
  --cat-drumming: oklch(0.55 0.11 25);
  --cat-recording: oklch(0.55 0.11 200);

  --measure: 560px; /* prose line length */
  --margin-col: 200px; /* left ledger column */
  --shell: 880px; /* page max width */

  font-family: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}
.site *,
.site *::before,
.site *::after {
  box-sizing: border-box;
}

.site.dark {
  --paper: #181512;
  --ink: #e9e4db;
  --faint: rgba(233, 228, 219, 0.55);
  --whisper: rgba(233, 228, 219, 0.36);
  --hair: rgba(233, 228, 219, 0.15);
  --panel: rgba(233, 228, 219, 0.06);
  --accent: oklch(0.78 0.12 75);
  --cat-programming: oklch(0.75 0.1 250);
  --cat-terminal: oklch(0.75 0.1 150);
  --cat-homelab: oklch(0.75 0.1 300);
  --cat-drumming: oklch(0.75 0.1 25);
  --cat-recording: oklch(0.75 0.1 200);
}

.cat {
  color: var(--cat-c);
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 72px 48px 56px;
}

/* ---------- entrance transition ---------- */
@media (prefers-reduced-motion: no-preference) {
  .page {
    animation: rise 0.3s ease both;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ---------- masthead ---------- */
.mast {
  margin-bottom: 72px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.mast h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  line-height: 1.3;
}
.mast h1 a {
  color: inherit;
  text-decoration: none;
}
.mast h1 .dot {
  color: var(--accent);
}
.mast .tagline {
  font-size: 12px;
  color: var(--faint);
  margin: 0;
}
.mast.compact {
  margin-bottom: 56px;
}
.mast.compact h1 {
  font-size: 16px;
  margin-bottom: 0;
}

.theme-btn {
  font-family: inherit;
  font-size: 11.5px;
  color: var(--faint);
  background: none;
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.theme-btn:hover {
  color: var(--ink);
  border-color: var(--faint);
}
.theme-btn .sym {
  color: var(--accent);
  margin-right: 6px;
}

/* ---------- category filter chip ---------- */
.filter {
  margin: -40px 0 40px;
  font-size: 12px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hair);
  border-radius: 99px;
  padding: 4px 12px;
  cursor: pointer;
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: inherit;
  transition: border-color 0.15s;
}
.filter .chip:hover {
  border-color: var(--faint);
}
.filter .chip .x {
  color: var(--whisper);
}

/* ---------- post index ---------- */
.entry {
  display: grid;
  grid-template-columns: var(--margin-col) 1fr;
  gap: 36px;
  padding: 26px 0;
  border-bottom: 1px dotted var(--hair);
  position: relative;
  cursor: pointer;
}
.entry:first-of-type {
  border-top: 1px dotted var(--hair);
}
.entry .margin {
  font-size: 12px;
  line-height: 1.7;
}
.entry .margin .d {
  color: var(--faint);
  display: block;
}
.entry .margin .cat {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.entry .margin .cat:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.entry .body h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.5;
  text-transform: lowercase;
}
.entry .body h2 a {
  color: inherit;
  text-decoration: none;
}
.entry .body .ex {
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.7;
  margin: 0;
  max-width: 540px;
}
.entry .arrow {
  position: absolute;
  left: -34px;
  top: 28px;
  color: var(--accent);
  font-weight: 700;
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.15s,
    transform 0.15s;
}
.entry:hover .arrow,
.entry.focused .arrow {
  opacity: 1;
  transform: translateX(0);
}
.entry:hover h2,
.entry.focused h2 {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 5px;
  text-decoration-thickness: 2px;
}

/* ---------- footer ---------- */
.foot {
  margin-top: 72px;
  display: grid;
  grid-template-columns: var(--margin-col) 1fr;
  gap: 36px;
  font-size: 11.5px;
  color: var(--whisper);
  align-items: baseline;
}
.foot nav {
  display: flex;
  gap: 24px;
}
.foot nav a {
  color: var(--faint);
  text-decoration: none;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.foot nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.foot nav a.active {
  color: var(--accent);
}
.foot kbd {
  color: var(--faint);
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-family: inherit;
}

/* ---------- post + simple pages ---------- */
.post {
  display: grid;
  grid-template-columns: var(--margin-col) 1fr;
  gap: 36px;
}
.pmargin {
  font-size: 12px;
  line-height: 1.8;
}
.pmargin .blk {
  margin-bottom: 28px;
}
.pmargin .lbl {
  color: var(--whisper);
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.08em;
}
.pmargin .val {
  color: var(--faint);
}
.pmargin .cat {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.pmargin .cat:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.pmargin .note {
  font-size: 11.5px;
  color: var(--faint);
  font-style: italic;
  line-height: 1.75;
  border-top: 1px dotted var(--hair);
  padding-top: 14px;
  margin-top: 44px;
}
.pmargin .note .pilcrow {
  color: var(--accent);
  font-style: normal;
}
.pmargin .note a {
  color: var(--accent);
  cursor: pointer;
}

.parea h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 44px;
  max-width: var(--measure);
}
.prose {
  max-width: var(--measure);
}
.prose p {
  font-size: 16px;
  line-height: 1.95;
  margin: 0 0 26px;
}
.prose .mark {
  color: var(--faint);
}
.prose h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 40px 0 16px;
}
.prose h2::before {
  content: "## ";
  color: var(--accent);
  font-weight: 400;
}
.quote {
  margin: 34px 0;
  font-size: 13px;
  font-style: italic;
  color: var(--faint);
  line-height: 1.85;
  padding-left: 24px;
}

.codewrap {
  background: var(--panel);
  border-radius: 4px;
  margin: 8px 0 32px;
  overflow: hidden;
}
.codebar {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--whisper);
  padding: 9px 26px 0;
}
.code {
  padding: 14px 26px 22px;
  margin: 0;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre;
  overflow-x: auto;
}
.code .cm {
  color: var(--whisper);
}
.code .kw {
  color: var(--accent);
}

.back {
  margin-top: 56px;
  font-size: 12.5px;
}
.back a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.back a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.prevnext {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dotted var(--hair);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 11.5px;
  color: var(--whisper);
  max-width: var(--measure);
}
.prevnext a {
  color: var(--faint);
  text-decoration: none;
  cursor: pointer;
  max-width: 45%;
}
.prevnext a:hover {
  color: var(--ink);
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .shell {
    padding: 48px 24px 40px;
  }
  .entry,
  .post,
  .foot {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .entry .margin {
    display: flex;
    gap: 14px;
  }
  .entry .margin .d,
  .entry .margin .cat {
    display: inline;
  }
  .entry .arrow {
    display: none;
  }
  .pmargin {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
  }
  .pmargin .blk {
    margin-bottom: 0;
  }
  .pmargin .note {
    display: none;
  }
  .mast h1 {
    font-size: 22px;
  }
}
