/* ishaanranjan.com: one quiet column.
   Newsreader for all text; the system monospace only for code in posts.
   Colors follow the reader's light or dark setting. */

:root {
  color-scheme: light dark;
  --bg: #fdfcf9;
  --ink: #1d1c1a;
  --ink-2: #5d5850;
  --ink-3: #757068; /* 4.6:1 on --bg, the floor for small text */
  --rule: #ebe7df;
  --line: #d2ccc0;
  --accent: #ad3a1f;
  --sel: rgba(173, 58, 31, .15);
  --code: #f4f1ea;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 36rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --ink: #ebe7df;
    --ink-2: #b2aca1;
    --ink-3: #888277;
    --rule: #282622;
    --line: #4a463f;
    --accent: #ef8a62;
    --sel: rgba(239, 138, 98, .25);
    --code: #1c1b19;
  }
}

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

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first;
}

::selection { background: var(--sel); }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  text-underline-offset: .18em;
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

p { margin: 0 0 1rem; text-wrap: pretty; }
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
cite { font-style: italic; }
img { display: block; max-width: 100%; height: auto; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

/* ---------- top bar: name and the two pages ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: clamp(1.75rem, 5vh, 3rem);
}
.who {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
.who img { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--rule); }
a.who:hover { color: inherit; }
.top nav { display: flex; gap: 1.25rem; font-size: 1rem; color: var(--ink-3); }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--accent); }
.top nav a[aria-current="page"] { color: var(--ink); }

/* ---------- home ---------- */
.home { padding-top: clamp(3rem, 11vh, 6.5rem); }
.home .lead { font-size: 1.3125rem; line-height: 1.45; margin-bottom: 1.6rem; }
.home section + section { margin-top: 1.6rem; }
.elsewhere { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-top: 2.25rem; font-size: 1rem; color: var(--ink-2); }

/* ---------- inner pages ---------- */
.page { padding-top: clamp(2.75rem, 8vh, 4.5rem); }
.title { font-size: 1.875rem; line-height: 1.2; letter-spacing: -.005em; margin-bottom: .75rem; }
.lede { color: var(--ink-2); }
.page h2 {
  margin: 3.25rem 0 1.25rem;
  font-size: .9375rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* One piece of work: when on the left, what on the right. */
.item { display: grid; grid-template-columns: 4.75rem 1fr; column-gap: 1rem; margin-bottom: 2rem; }
.when { margin: 0; padding-top: .12rem; font-size: 1rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.item .where { margin: 0 0 .45rem; font-size: 1rem; font-style: italic; color: var(--ink-2); }
.item p { margin-bottom: .55rem; }
.links { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin: 0; font-size: 1rem; color: var(--ink-2); }
.links a[href^="http"]::after { content: "\2197" / ""; display: inline-block; margin-left: .2em; font-size: .85em; color: var(--ink-3); }

/* Papers and prizes: a plain list with the year in the same left column. */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 4.75rem 1fr; column-gap: 1rem; margin-bottom: .9rem; }
.list .when { padding-top: .1rem; }
.paper a { font-weight: 500; }
.paper .sub { color: var(--ink-2); }
.paper .meta { display: block; margin-top: .1rem; font-size: 1rem; color: var(--ink-3); }

/* ---------- blog ---------- */
.posts { list-style: none; margin: 2.25rem 0 0; padding: 0; }
.posts li { display: grid; grid-template-columns: 6.25rem 1fr; column-gap: 1rem; padding: .45rem 0; }
.posts time { font-size: 1rem; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: .1rem; }
.posts .tag { margin-left: .5rem; font-size: .875rem; color: var(--ink-3); font-style: italic; }
.empty { color: var(--ink-3); font-style: italic; }

.post-head { padding-top: clamp(2.75rem, 8vh, 4.5rem); margin-bottom: 2.25rem; }
.post-head h1 { font-size: clamp(1.875rem, 1.35rem + 2.2vw, 2.5rem); line-height: 1.12; letter-spacing: -.012em; }
.post-head p { margin: .8rem 0 0; font-size: 1rem; color: var(--ink-3); }

.prose { font-size: 1.1875rem; line-height: 1.68; }
.prose p { margin-bottom: 1.15rem; }
.prose h2 { margin: 2.5rem 0 .8rem; font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
.prose h3 { margin: 2rem 0 .6rem; font-size: 1.1875rem; font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--ink-3); }
.prose blockquote { margin: 1.6rem 0; padding-left: 1.15rem; border-left: 2px solid var(--line); color: var(--ink-2); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .82em; background: var(--code); padding: .12em .35em; border-radius: 4px; }
.prose pre { margin: 1.6rem 0; padding: 1rem 1.15rem; overflow-x: auto; background: var(--code); border-radius: 6px; font-size: .9rem; line-height: 1.55; }
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose figure { margin: 2rem 0; }
.prose figure img { border-radius: 4px; }
.prose figcaption { margin-top: .55rem; font-size: 1rem; font-style: italic; color: var(--ink-3); }
.prose hr { margin: 2.6rem 0; border: 0; text-align: center; }
.prose hr::after { content: "\2042"; color: var(--ink-3); }
.prose sup a { text-decoration: none; color: var(--accent); }
.footnotes { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 1rem; color: var(--ink-2); }
.footnotes ol { padding-left: 1.2rem; }

/* ---------- blog sign-up ---------- */
.signup { margin: 2.75rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.signup label { display: block; margin-bottom: .85rem; color: var(--ink-2); }
.signup-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.signup input {
  flex: 1 1 14rem;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .5rem .7rem;
}
.signup button {
  font: inherit;
  font-size: 1rem;
  padding: .5rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}
.signup button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- notes pages: privacy, agents, tokens ---------- */
.stamp { margin: 0; font-size: 1rem; color: var(--ink-3); }
.doc-head .stamp { margin-top: -.25rem; }
.ledger-head .stamp { margin-bottom: .35rem; }
.doc ul { margin: 0 0 1rem; padding-left: 1.3rem; }
.doc li { margin: .3rem 0; }
.doc li::marker { color: var(--ink-3); }
.doc code { font-family: var(--mono); font-size: .82em; background: var(--code); padding: .12em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.doc pre { margin: 1.25rem 0; padding: .9rem 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code); border-radius: 6px; font-size: .9rem; line-height: 1.55; }
.doc pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
.doc blockquote { margin: 1.25rem 0; padding-left: 1.1rem; border-left: 2px solid var(--line); color: var(--ink-2); font-style: italic; }
.doc form { display: grid; gap: .9rem; margin: 1.25rem 0 1rem; }
.doc label { display: grid; gap: .3rem; font-size: 1rem; color: var(--ink-2); }
.doc input, .doc select, .doc textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .45rem .6rem;
}
.doc textarea { min-height: 6rem; resize: vertical; }
.doc button {
  justify-self: start;
  font: inherit;
  font-size: 1rem;
  padding: .45rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}
.doc button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-top: 5.5rem;
  padding: 1.1rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-size: .9375rem;
  color: var(--ink-3);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--accent); }
.ring { display: flex; gap: .6rem; }

/* ---------- small screens ---------- */
@media (max-width: 36rem) {
  body { font-size: 1.0625rem; }
  .home { padding-top: clamp(2.25rem, 8vh, 4rem); }
  .home .lead { font-size: 1.1875rem; }
  .item, .list li { grid-template-columns: 1fr; }
  .when { padding-top: 0; margin-bottom: .1rem; }
  .posts li { grid-template-columns: 1fr; padding: .55rem 0; }
  .prose { font-size: 1.125rem; }
}

/* ---------- print: the portfolio page prints as a CV ---------- */
@media print {
  :root { --bg: #fff; --ink: #000; --ink-2: #333; --ink-3: #555; --rule: #ccc; }
  body { font-size: 10.5pt; }
  .top nav, .foot, .who img, .signup { display: none; }
  .page h2 { margin-top: 1.4rem; }
  .item, .list li { break-inside: avoid; }
  a { text-decoration: none; }
}

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