@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-700.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/source-serif-4-400.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/source-serif-4-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/source-serif-4-600.woff2") format("woff2");
}

:root {
  --bg: #222436;
  --fg: #c8d3f5;
  --fg-dim: #828bb8;
  --fg-dimmer: #3b4261;
  --accent: #ff757f;
  --code-bg: #1e2030;
  --pill-bg: #2f334d;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace;
  --serif: "Source Serif 4", Georgia, serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}
body {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "calt", "ss01";
}
::selection {
  background: rgba(255, 117, 127, 0.3);
  color: var(--fg);
}

/* ============== tab bar ============== */
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-bottom: 1px solid #2f334d;
  padding: 0 1.4rem;
  font-size: 13px;
  height: 36px;
  flex: 0 0 auto;
  user-select: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 0.95rem;
  color: var(--fg-dim);
  white-space: nowrap;
  position: relative;
  text-decoration: none;
}
.tab:hover {
  color: var(--fg);
}
.tab.active {
  color: var(--fg);
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.tab .mod {
  color: var(--fg-dim);
  margin-left: 0.4rem;
  font-size: 10px;
}
.tab.active .mod {
  color: var(--accent);
}
.tabs .spacer {
  flex: 1 1 auto;
}
.tabs .session {
  display: inline-flex;
  align-items: center;
  color: var(--fg-dim);
  font-size: 12px;
  padding-right: 1rem;
  margin-right: 0.8rem;
  border-right: 1px solid #2f334d;
}

/* ============== editor surface ============== */
.surface {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2.6rem 0 0;
}
.surface::-webkit-scrollbar {
  width: 8px;
}
.surface::-webkit-scrollbar-thumb {
  background: #3b4261;
  border-radius: 4px;
}
.surface::-webkit-scrollbar-track {
  background: transparent;
}

/* ============== INDEX (no gutter) ============== */
.index {
  max-width: 88ch;
  margin: 0 auto;
  padding: 0 1.6rem 4rem;
}
.index .prompt {
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 12px;
  margin: 0 0 1.8rem;
  letter-spacing: 0;
}
.index .prompt .sep {
  color: var(--fg-dimmer);
  margin: 0 0.5rem;
}
.index .prompt .cmd {
  color: var(--fg);
}
.index h1.title {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
  color: var(--fg);
}
.index .tagline {
  color: var(--fg-dim);
  margin: 0 0 1.4rem;
  font-size: 0.96rem;
  max-width: 60ch;
}

.index h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--fg-dim);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed #2f334d;
}

/* dotted-leader rows */
.toc {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: var(--mono);
}
.toc-row {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.32rem 0;
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.toc-row:hover .title-text {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.toc-row .date {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.toc-row .title-text {
  flex: 0 1 auto;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.toc-row .dots {
  color: var(--fg-dim);
  overflow: hidden;
  white-space: nowrap;
  flex: 1 1 1ch;
  min-width: 1ch;
  opacity: 0.5;
  letter-spacing: 0.18em;
  align-self: baseline;
}
.toc-row .read {
  color: var(--fg-dim);
  font-size: 12px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.toc-empty {
  padding: 0.32rem 0;
  font-size: 14px;
  color: var(--fg-dim);
  font-style: italic;
  opacity: 0.7;
}

.index .elsewhere {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  font-family: var(--mono);
  font-size: 14px;
}
.index .elsewhere .row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}
.index .elsewhere .k {
  color: var(--fg-dim);
  min-width: 5ch;
}
.index .elsewhere a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.index .tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 1rem;
}

.index .colophon {
  margin-top: 3.2rem;
  padding-top: 1.2rem;
  border-top: 1px dashed #2f334d;
  color: var(--fg-dim);
  font-size: 12px;
  font-family: var(--mono);
}

/* ============== POST (gutter) ============== */
.post-wrap {
  max-width: calc(88ch + 4rem);
  margin: 0 auto;
  padding: 0 1.6rem 4rem;
}
.post-wrap .prose {
  counter-reset: ln;
  padding-left: 3.5rem;
  position: relative;
  max-width: none;
}
.post-wrap .prose > * {
  position: relative;
  counter-increment: ln;
}
.post-wrap .prose > *::before {
  content: counter(ln);
  position: absolute;
  left: -3.5rem;
  top: 0.6em;
  width: 2.2rem;
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-dim);
  opacity: 0.65;
  line-height: 1.5;
  user-select: none;
}
.post-wrap .prose > .codeblock::before {
  top: 0.65rem;
}
.post-wrap .prose > hr::before {
  top: 0;
}

/* ============== prose ============== */
.prose {
  font-family: var(--serif);
  line-height: 1.7;
  font-size: 17px;
  min-width: 0;
}
.prose h1,
.prose h2,
.prose h3 {
  color: var(--fg);
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.005em;
  font-family: var(--serif);
}
.prose h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.prose h2 {
  font-size: 1.3rem;
  margin: 2.4rem 0 0.7rem;
}
.prose h3 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.4rem;
}
.prose p {
  margin: 0 0 1.1rem;
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose em {
  font-style: italic;
}
.prose strong {
  font-weight: 600;
  color: var(--fg);
}
.prose hr {
  border: 0;
  border-top: 1px dashed #2f334d;
  margin: 2rem 0;
}
.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover {
  text-decoration-thickness: 2px;
}

/* inline code — always mono */
.prose code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--fg);
  background: var(--code-bg);
  padding: 0.06em 0.4em;
  border-radius: 2px;
  border: 1px solid #2f334d;
}

/* tag chips */
.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 12px;
}
.tag {
  color: var(--accent);
  padding: 0;
  letter-spacing: 0;
}
.tag::before {
  content: "#";
  color: var(--accent);
  opacity: 0.7;
  margin-right: 0.05em;
}
a.tag {
  text-decoration: none;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 12px;
  margin: 0.4rem 0 2rem;
}
.post-meta .date {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* blockquote */
.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--fg-dim);
  color: var(--fg-dim);
  font-style: italic;
}
.prose blockquote p {
  margin: 0;
}

/* lists */
.prose ul,
.prose ol {
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}
.prose ul li,
.prose ol li {
  position: relative;
  padding-left: 1.3rem;
  margin-bottom: 0.45rem;
}
.prose ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg-dim);
}
.prose ol {
  counter-reset: i;
}
.prose ol li {
  counter-increment: i;
}
.prose ol li::before {
  content: counter(i) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}

/* anchor-link on headings (markdown-it-anchor headerLink wraps the heading in an <a>) */
.prose .anchor {
  color: inherit;
  text-decoration: none;
}
.prose .anchor:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* ============== code blocks (Shiki kanagawa-wave preserved inside) ============== */
.codeblock {
  position: relative;
  background: var(--code-bg);
  border: 1px solid #2f334d;
  border-radius: 3px;
  margin: 1.4rem 0 1.6rem;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  overflow: hidden;
}
.codeblock .filename {
  position: absolute;
  top: 0.45rem;
  right: 0.8rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0;
  user-select: none;
  z-index: 1;
}
.codeblock pre,
.codeblock pre.shiki {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  white-space: pre;
  font-family: var(--mono);
  background: var(--code-bg) !important;
}
.codeblock pre::-webkit-scrollbar {
  height: 6px;
}
.codeblock pre::-webkit-scrollbar-thumb {
  background: #3b4261;
  border-radius: 3px;
}
.codeblock code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ============== lualine (quiet) ============== */
.lualine {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-top: 1px solid #2f334d;
  height: 26px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  flex: 0 0 auto;
}
.lualine .mode {
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  background: var(--pill-bg);
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 3px 0 3px 0.6rem;
  border-radius: 1px;
}
.lualine .seg {
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  color: var(--fg-dim);
}
.lualine .file {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lualine .file .mod {
  color: var(--accent);
  margin-left: 0.4rem;
}
.lualine .right {
  display: inline-flex;
  align-items: stretch;
}
.lualine .right .seg {
  border-left: 1px solid #2f334d;
}

/* responsive */
@media (max-width: 720px) {
  .post-wrap .prose {
    padding-left: 2.2rem;
  }
  .post-wrap .prose > *::before {
    left: -2.2rem;
    width: 1.6rem;
    font-size: 10px;
  }
  .index {
    padding: 0 1rem 4rem;
  }
  .post-wrap {
    padding: 0 1rem 4rem;
  }
  .toc-row .dots {
    display: none;
  }
  .tabs {
    padding: 0 0.6rem;
  }
  .tab {
    padding: 0 0.7rem;
  }
}
