/* ════════════════════════════════════════════════════════════════
   EDITORIAL MINIMAL  —  warm paper, ink, a single terracotta accent
   ════════════════════════════════════════════════════════════════ */

:root {
  --paper:      #f6f2e9;
  --paper-2:    #efe9db;
  --ink:        #211e1a;
  --ink-soft:   #5a554c;
  --ink-faint:  #8a8478;
  --rule:       #d8d0bf;
  --accent:     #b4451f;   /* terracotta */
  --accent-2:   #8a3416;
  --code-bg:    #2b2723;
  --code-fg:    #ece4d4;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --body:  "Newsreader", Georgia, serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --deva:  "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", var(--serif);

  --maxw: 72rem;
  --readw: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #1a1815;
    --paper-2:  #211e1a;
    --ink:      #ece4d4;
    --ink-soft: #b3aa98;
    --ink-faint:#7c7568;
    --rule:     #38332c;
    --accent:   #e07a4e;
    --accent-2: #f0926a;
    --code-bg:  #100f0d;
    --code-fg:  #e6ddcd;
  }
}

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

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

/* ── Custom scrollbars ─────────────────────────────────────────
   Warm, thin, palette-matched; follows light/dark automatically. */
html {
  scrollbar-width: thin;                              /* Firefox */
  scrollbar-color: var(--rule) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }    /* WebKit/Blink */
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 999px;
  border: 3px solid var(--paper);                     /* inset from edges */
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: transparent; }

/* Thin variant for inner scroll areas (code blocks, equations, tables) */
.prose pre,
.prose .katex-display,
.prose .table-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
.prose pre::-webkit-scrollbar,
.prose .katex-display::-webkit-scrollbar { height: 8px; width: 8px; }
.prose pre::-webkit-scrollbar-thumb,
.prose .katex-display::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border: 2px solid var(--code-bg);
}
.prose .katex-display::-webkit-scrollbar-thumb { border-color: var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

/* film-grain overlay for paper texture */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  .grain { mix-blend-mode: screen; opacity: 0.05; }
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--paper); }

/* ── Layout shell ─────────────────────────────────────────────── */
.site-head,
.site-main,
.site-foot { width: min(100% - 3rem, var(--maxw)); margin-inline: auto; }

.site-main { min-height: 60vh; }

/* ── Header ───────────────────────────────────────────────────── */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2.2rem 0 1.6rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.brand-dot { color: var(--accent); }
.site-nav { display: flex; gap: 1.6rem; }
.site-nav a {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 0.2rem;
  transition: color 0.2s ease;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  padding: 1rem 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 29rem);
  gap: 3.5rem;
  align-items: start;
}
.hero-text { max-width: 37rem; padding-top: 0.5rem; }

.hero-media {
  margin: 0;
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.24s both;
}
.hero-media img {
  width: 100%; height: auto; display: block;
  /* keyed-out background lets the statue merge into the page */
}
.hero-media figcaption {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-align: right;
  margin-top: 0.5rem;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-media { max-width: 17rem; order: 2; }
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 1.4rem;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero-name {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 1.5rem + 8vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 1.8rem;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.06s both;
}
.hero-intro {
  font-size: clamp(1.15rem, 1.05rem + 0.45vw, 1.45rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 0 2.2rem;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.12s both;
}
.hero-shloka {
  margin: 0 0 2.2rem;
  padding-left: 1.3rem;
  border-left: 2px solid var(--accent);
  max-width: 36rem;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.16s both;
}
.shloka-deva {
  font-family: var(--deva);
  font-size: 1.4rem;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
  white-space: pre-line; /* render the verse's two lines */
}
.shloka-translit {
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.4rem 0 0;
  white-space: pre-line;
}
.shloka-gloss {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0.45rem 0 0;
}
.hero-shloka cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.hero-shloka cite a { color: var(--ink-faint); transition: color 0.2s; }
.hero-shloka cite a span { color: var(--accent); }
.hero-shloka cite a:hover { color: var(--accent); }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.18s both;
}
.hero-links a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.15rem;
  transition: border-color 0.2s, color 0.2s;
}
.hero-links a span { color: var(--accent); transition: transform 0.2s; display: inline-block; }
.hero-links a:hover { border-color: var(--accent); }
.hero-links a:hover span { transform: translate(2px, -2px); }

@keyframes rise {
  from { opacity: 0; transform: translateY(1.2rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Content blocks ───────────────────────────────────────────── */
.block { padding: 3rem 0; border-top: 1px solid var(--rule); }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.block-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  letter-spacing: -0.02em;
  margin: 0;
}
.block-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ── Projects ─────────────────────────────────────────────────── */
.projects {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.project { background: var(--paper); }
.project-link {
  display: block;
  padding: 1.8rem;
  height: 100%;
  transition: background 0.25s ease;
}
.project-link:hover { background: var(--paper-2); }
.project-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.project-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.project-year { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); white-space: nowrap; }
.project-blurb { color: var(--ink-soft); font-size: 1rem; line-height: 1.5; margin: 0 0 1.2rem; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; }
.tags li {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 0.2rem 0.65rem;
  transition: border-color 0.2s, color 0.2s;
}
.tags li a { color: inherit; }
.tags li:hover { border-color: var(--accent); color: var(--accent); }

/* tag cloud (/tags/) */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.tag-chip {
  font-family: var(--mono); font-size: 0.82rem;
  color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 100px;
  padding: 0.4rem 0.95rem;
  transition: border-color 0.2s, color 0.2s;
}
.tag-chip span { color: var(--ink-faint); margin-left: 0.35rem; }
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Entry lists (post links) ─────────────────────────────────── */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 0.2rem 0; }
.entry-link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0;
}
.entry-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  transition: color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-rule {
  flex: 1;
  border-bottom: 1px dotted var(--rule);
  transform: translateY(-0.25rem);
  min-width: 1rem;
}
.entry-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
.entry-link:hover .entry-title { color: var(--accent); }
.entry-desc { color: var(--ink-soft); font-size: 1rem; margin: -0.4rem 0 0.6rem; max-width: var(--readw); }

.entry-meta { display: inline-flex; align-items: baseline; gap: 0.7rem; white-space: nowrap; }
.entry-kind {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.more-row { display: flex; flex-wrap: wrap; gap: 1.8rem; margin-top: 1.8rem; }
.more {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.more:hover { border-color: var(--accent); }

.empty { color: var(--ink-soft); font-style: italic; }
.empty code, .entry-desc code { font-family: var(--mono); font-size: 0.85em; font-style: normal; }

/* ── Page headers (blog index, etc.) ──────────────────────────── */
.page-head { padding: 1rem 0 3rem; border-bottom: 1px solid var(--rule); margin-bottom: 3rem; }
.page-head h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  line-height: 1;
}
.page-sub { color: var(--ink-soft); margin: 0; font-size: 1.1rem; }

.year-group { margin-bottom: 3rem; }
.year-label {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

/* ── Post / article ───────────────────────────────────────────── */
.post { max-width: 100%; margin-inline: auto; }
.post-head { margin-bottom: 3rem; }
.back {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}
.back:hover { color: var(--accent); }
.post-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 1.4rem + 3.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 1.4rem 0 1.2rem;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}
.post-meta .dot { opacity: 0.5; }
.post-foot { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--rule); }

/* ── About portrait (floats right, bio wraps beside it) ───────── */
.portrait {
  float: right;
  margin: 0 0 1.5rem 2rem;
  /* transparent cutout → text wraps the person's actual contour */
  shape-outside: url(Ashutosh-cut.png);
  shape-image-threshold: 0.1; /* faint edges count as solid → text kept off them */
  shape-margin: 2.6rem;        /* loose clearance between text and silhouette */
}
.portrait img {
  display: block;
  height: 56vh;          /* 80vh reduced by 30% */
  width: auto;
  max-width: 100%;
  /* keyed-out background — merges into the page, no frame */
}
.portrait figcaption {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: right;
  margin-top: 0.5rem;
}
@media (max-width: 860px) {
  .portrait { float: none; margin: 0 0 1.5rem; shape-outside: none; }
  .portrait img { height: auto; width: 100%; }
}

/* ── Prose (rendered markdown) ────────────────────────────────── */
.prose { font-size: 1.18rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.4rem; }
.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 2.6rem;
}
.prose h2 { font-size: 1.9rem; }
.prose h3 { font-size: 1.45rem; }
.prose h4 { font-size: 1.2rem; }
.prose p { margin: 0; }
.prose a {
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color 0.2s;
}
.prose a:hover { border-color: var(--accent); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.4rem;
  margin-left: 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.25rem;
}
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-top: 0.5rem; }
.prose li::marker { color: var(--accent); }

.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem auto;
  width: 40%;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 1.6rem auto;
  border: 1px solid var(--rule);
  background: #fff;
}

.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1.3rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-inline: -0.5rem;
}
.prose pre code { font-family: var(--mono); }

/* mermaid diagrams — not a code block; let the rendered SVG breathe */
.prose pre.mermaid {
  background: none;
  color: transparent;       /* hide raw source before render */
  padding: 0;
  margin: 2.4rem 0;
  text-align: center;
  overflow: visible;
  line-height: 0;
}
.prose pre.mermaid[data-processed="true"] { line-height: normal; }
.prose pre.mermaid svg { max-width: 100%; height: auto; }

/* KaTeX — display equations get breathing room and scroll on narrow screens */
.prose .katex-display {
  margin: 1.4rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}
.prose .katex { font-size: 1.04em; }

.prose .table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.prose td:first-child, .prose th:first-child { padding-left: 0; }
.prose td { font-variant-numeric: tabular-nums; }
.prose th { font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }

/* drop cap on first paragraph of a post */
.post .prose > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  float: left;
  font-size: 3.6rem;
  line-height: 0.78;
  padding: 0.1rem 0.6rem 0 0;
  color: var(--accent);
}

/* ── syntax highlighting (highlight.js, warm-paper theme) ─────── */
.hljs-comment, .hljs-quote { color: #8c8378; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #e07a4e; }
.hljs-string, .hljs-meta-string { color: #c5d86d; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #e8b06b; }
.hljs-title, .hljs-section, .hljs-name { color: #7fb3d5; }
.hljs-attr, .hljs-attribute, .hljs-variable { color: #d4a8e0; }
.hljs-built_in, .hljs-class .hljs-title { color: #8fd6c4; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ── Footer ───────────────────────────────────────────────────── */
.site-foot {
  margin-top: 6rem;
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.foot-links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.foot-links a:hover { color: var(--accent); }
.foot-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); margin: 0; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-head { flex-direction: column; gap: 1rem; align-items: flex-start; margin-bottom: 2.5rem; }
  .entry-link { flex-wrap: wrap; gap: 0.3rem; }
  .entry-rule { display: none; }
  .post .prose > p:first-of-type::first-letter { font-size: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
