/* bishal — notebook style: mono for the interface, serif for reading. */

/* Geist Serif (SIL OFL 1.1, assets/fonts/geist-serif/LICENSE.txt). A display face with
   one weight and no italic yet, so it's used for titles only, not essay body text. */
@font-face {
  font-family: "Geist Serif";
  src: url("/assets/fonts/geist-serif/GeistSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfaf7;
  --bg-soft: #f2f0ea;
  --fg: #1c1b19;
  --muted: #6d6a62;
  --rule: #e2dfd7;
  --accent: #b4410e;
  --accent-soft: rgba(180, 65, 14, 0.09);

  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --display: "Geist Serif", Charter, "Sitka Text", Georgia, serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", "Iowan Old Style", Cambria, Georgia, serif;

  --measure: 42rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --bg-soft: #1c1c1a;
    --fg: #e7e4dd;
    --muted: #9a968c;
    --rule: #2c2b28;
    --accent: #ef8a4c;
    --accent-soft: rgba(239, 138, 76, 0.12);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Full-height column so the footer sits at the bottom on short pages. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  max-width: calc(var(--measure) + 2rem);
  padding: 0 1rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.6;
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: var(--accent-soft); }

/* Header & footer --------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}

.site-title { font-weight: 700; text-decoration: none; }
.site-title::before { content: "~/"; color: var(--accent); font-weight: 400; }

.site-nav { display: flex; gap: 1.25rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--fg); }
.site-nav a[aria-current]::before { content: "/"; color: var(--accent); }

main { flex: 1; min-width: 0; padding: 2.5rem 0 3rem; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  padding: 1.25rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}
.site-footer a { color: inherit; }
.sep { color: var(--rule); }

/* Shared bits ------------------------------------------------------------- */

.label {
  display: block;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta { margin: 0; color: var(--muted); font-size: 0.8125rem; }

.tags { margin: 0.75rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.page-title, .post-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2rem, 1.6rem + 1.8vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.page-title { margin-bottom: 1.5rem; }

section + section { margin-top: 3rem; }

.more { display: inline-block; margin-top: 1rem; color: var(--muted); font-size: 0.8125rem; }

/* Home ------------------------------------------------------------------- */

.intro {
  margin: 0 0 3rem;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
}
.intro p { margin: 0 0 0.75em; }

.feature { display: block; text-decoration: none; }
.feature h2 {
  margin: 0.25rem 0 0.5rem;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.25;
}
.feature p { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 1.0625rem; }
.feature:hover h2 { color: var(--accent); }
.feature:hover p { color: var(--muted); }

/* Writing index ----------------------------------------------------------- */

.year {
  margin: 2rem 0 0.5rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 400;
}
.year:first-child { margin-top: 0; }

.index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.index li {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.index time, .index .reading-time { color: var(--muted); font-size: 0.8125rem; }
.index a { font-family: var(--serif); font-size: 1.0625rem; text-decoration: none; }

/* Projects --------------------------------------------------------------- */

.projects { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.projects li { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.project-name { font-weight: 700; }
.project-meta { color: var(--muted); font-size: 0.75rem; }
.project-desc { margin: 0.35rem 0 0; font-family: var(--serif); font-size: 1.0625rem; }
.project-links { margin: 0.4rem 0 0; display: flex; gap: 1rem; font-size: 0.8125rem; color: var(--muted); }
.project-links a { color: inherit; }

/* Post ------------------------------------------------------------------- */

.post-header { margin-bottom: 2.5rem; }
.post-header .meta { margin-bottom: 0.6rem; }

.post-nav {
  display: grid;
  gap: 0.75rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
}
.post-nav a { text-decoration: none; }
.post-nav .label { margin: 0; font-size: 0.6875rem; }
.post-nav .all { color: var(--muted); }

/* Prose: the essay body -------------------------------------------------- */

.prose {
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  hanging-punctuation: first;
}

.prose > :first-child { margin-top: 0; }

.prose p, .prose ul, .prose ol, .prose blockquote, .prose table,
.prose details, .prose pre, .prose figure { margin: 0 0 1.25em; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin: 2.25em 0 0.75em;
  font-family: var(--mono);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.prose h2 { font-size: 1.0625rem; }
.prose h2::before { content: "## "; color: var(--accent); font-weight: 400; }
.prose h3 { font-size: 0.9375rem; }
.prose h3::before { content: "### "; color: var(--accent); font-weight: 400; }
.prose h4 { font-size: 0.875rem; }
.prose h5, .prose h6 {
  margin: 1.5em 0 1em;
  font-size: 1.1875rem;
  font-weight: 400;
  line-height: 1.5;
}

.prose a { color: var(--accent); text-decoration-color: var(--accent-soft); }
.prose a:hover { text-decoration-color: currentColor; }

.prose strong { font-weight: 700; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.25em 0; }
.prose li::marker { color: var(--muted); }

.prose hr {
  margin: 2.5em auto;
  width: 4rem;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose blockquote {
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.prose blockquote > :last-child { margin-bottom: 0; }

.prose img, .prose video { display: block; max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 3px; }

/* Code */
.prose code, .prose kbd, .prose pre {
  font-family: var(--mono);
  font-size: 0.8em;
}
.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--bg-soft);
}
.prose pre {
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-soft);
  line-height: 1.55;
}
.prose div.highlighter-rouge, .prose figure.highlight { margin: 0 0 1.25em; }
.prose div.highlighter-rouge pre, .prose figure.highlight pre { margin: 0; }

/* Tables: scroll sideways on small screens instead of squashing. */
.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.prose th, .prose td { padding: 0.45rem 1rem 0.45rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.6875rem; border-bottom-color: var(--fg); }

/* <details> */
.prose details {
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-soft);
  font-size: 1.0625rem;
}
.prose summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  list-style: none;
}
.prose summary::-webkit-details-marker { display: none; }
.prose summary::before { content: "+ "; color: var(--accent); }
.prose details[open] summary::before { content: "− "; }
.prose details[open] summary { margin-bottom: 0.6rem; }
.prose summary:hover { color: var(--fg); }

/* Math */
.prose .katex { font-size: 1.05em; }
.prose .katex-display { margin: 0.75em 0; overflow-x: auto; overflow-y: hidden; padding: 0.25em 0; }

/* Footnotes */
.prose .footnotes { margin-top: 3em; padding-top: 1em; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.prose sup { line-height: 0; }

/* Syntax highlighting (rouge) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt { color: var(--accent); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sx { color: #3f7d4f; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh { color: #8a5aa8; }
.highlight .nf, .highlight .nc { font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sx { color: #8fc69b; }
  .highlight .m, .highlight .mi, .highlight .mf, .highlight .mh { color: #c6a0e0; }
}

/* Small screens ----------------------------------------------------------- */

@media (max-width: 34rem) {
  .site-header { padding-top: 1.25rem; }
  .prose, .intro { font-size: 1.0625rem; }
  .index li { grid-template-columns: 1fr auto; gap: 0.1rem 1rem; }
  .index li a { grid-column: 1 / -1; grid-row: 1; }
}

@media print {
  .site-header, .site-footer, .post-nav { display: none; }
  body { max-width: none; }
}
