/* ------------------------------------------------------------------
   Apoorva Sharma — blog
   One column, serif for reading, mono for the ledger. Nothing else.
------------------------------------------------------------------- */

:root {
  --paper: #fcfcfa;
  --ink: #1c1e21;
  --muted: #6f747b;
  --accent: #2f45c5;
  --hairline: #e7e6e1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16171a;
    --ink: #e8e6e1;
    --muted: #8f9298;
    --accent: #93a2f2;
    --hairline: #2a2c30;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

:root {
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
}

.page {
  max-width: none;
  margin-inline: auto;
  padding: clamp(3rem, 7vh, 5.5rem) var(--gutter) 4.5rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

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

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 3rem;
  flex-wrap: wrap;
}

.masthead h1 {
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  font-size: clamp(2.125rem, 4.5vw, 3.5rem);
  font-style: normal;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.masthead p {
  color: var(--muted);
  max-width: 40rem;
}

/* ---- knowledge graph ---- */

.graph {
  margin-top: clamp(2rem, 4vh, 3.25rem);
  margin-inline: calc(var(--gutter) * -1); /* full-bleed */
  border-block: 1px solid var(--hairline);
  background-image: radial-gradient(var(--hairline) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow: hidden;
}

.graph svg {
  display: block;
  width: 100%;
  height: auto;
}

.graph .edge {
  stroke: var(--muted);
  stroke-opacity: 0.4;
  stroke-width: 1.25;
  transition: stroke-opacity 140ms ease, opacity 140ms ease;
}

.graph .arrowhead {
  fill: var(--muted);
  fill-opacity: 0.55;
}

.graph .edge-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  fill: var(--accent);
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
}

.graph .node {
  cursor: pointer;
  touch-action: none;
  text-decoration: none;
  transition: opacity 140ms ease;
}

.graph .node circle {
  fill: var(--ink);
  transition: fill 140ms ease;
}

.graph .node circle.hit {
  fill: transparent; /* enlarged touch target only — never painted */
}

.graph .node text {
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  font-size: 12.5px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.graph .node:hover circle:not(.hit),
.graph .node:focus-visible circle:not(.hit),
.graph .node.hl circle:not(.hit) {
  fill: var(--accent);
}

.graph.is-focus .node:not(.hl),
svg.is-focus .node:not(.hl) {
  opacity: 0.25;
}

svg.is-focus .edge:not(.hl) {
  opacity: 0.15;
}

svg.is-focus .edge.hl {
  stroke: var(--accent);
  stroke-opacity: 0.9;
}

svg.is-focus .edge-label.hl {
  opacity: 1;
}

.graph-legend {
  display: block;
  margin-top: 0.875rem;
}

/* ---- archive list ---- */

.archive {
  margin-top: 3.5rem;
}

.archive .label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-list {
  list-style: none;
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  column-gap: 3rem;
}

.post-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 0 1.1rem;
  border-top: 1px solid var(--hairline);
}

.post-list time {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.post-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1875rem;
  font-weight: 400;
}

.post-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.site-footer {
  margin-top: 4.5rem;
}

/* ---- post pages ---- */

.crumb {
  display: inline-block;
  margin-bottom: 3.5rem;
  text-decoration: none;
}

.crumb:hover {
  color: var(--accent);
}

article {
  max-width: 46rem;
  margin-inline: auto;
}

article header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.2;
  max-width: 60rem;
}

article header time {
  display: block;
  margin-top: 0.875rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.prose {
  margin-top: 2.75rem;
  max-width: 46rem; /* full-width page, but the text column stays readable */
}

.prose p {
  margin-bottom: 1.4rem;
}

.prose .lede {
  font-size: 1.25rem;
  font-style: italic;
  color: var(--muted);
}

.prose h2 {
  font-size: 1.3125rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.4rem 1.4rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose blockquote {
  margin: 0 0 1.4rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--hairline);
  color: var(--muted);
  font-style: italic;
}

.prose code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--hairline);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.prose pre {
  background: var(--hairline);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 2.5rem auto;
  width: 5rem;
}

/* ---- small screens ---- */

@media (max-width: 540px) {
  body {
    font-size: 1.0625rem;
  }

  .masthead p {
    font-size: 1rem;
  }

  .graph-legend {
    font-size: 0.7rem;
  }

  .archive {
    margin-top: 2.75rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a {
    transition: color 120ms ease, text-decoration-thickness 120ms ease;
  }
}
