/* akarshgopal.github.io. One text column with a margin for notes. Plain CSS, no build step. */

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

:root {
  color-scheme: light;
  --paper: #fbfaf6;
  --ink: #1f1e1b;
  --ink-2: #4b4a45;
  --quiet: #706e67;
  --rule: #e4e1d8;
  --red: #a8402f;
  --hl: #f3e3cf;
  --text: 20px;
  --col: 37rem;      /* the text column */
  --note: 15.5rem;   /* the margin */
  --gap: 3.5rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #151412; --ink: #e9e6de; --ink-2: #c4c0b6; --quiet: #9a968c; --rule: #2e2c27; --red: #e08a72; --hl: #3a2c22;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151412; --ink: #e9e6de; --ink-2: #c4c0b6; --quiet: #9a968c; --rule: #2e2c27; --red: #e08a72; --hl: #3a2c22;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--text)/1.6 "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  font-optical-sizing: auto; font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1.1em; }
a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: .18em; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--red); text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--hl); }
code { font: .82em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.skip { position: absolute; left: -999px; top: .75rem; z-index: 5; background: var(--ink); color: var(--paper); padding: .4rem .7rem; font-size: .85rem; }
.skip:focus { left: .75rem; }
.nums { font-variant-numeric: lining-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* page frame */
.page { width: min(100% - 2.5rem, calc(var(--col) + var(--gap) + var(--note))); margin: 0 auto; padding: 4.5rem 0 5rem; }
main > :not(.note):not(.pair):not(.row):not(.wide), .pair > :not(.note), .row > :not(.note) { max-width: var(--col); }

/* masthead */
.mast { display: flex; align-items: baseline; gap: .5rem 1.5rem; flex-wrap: wrap; max-width: var(--col); margin-bottom: 4.5rem; font-size: 1rem; }
.mast .name { font-weight: 600; font-size: 1.1rem; text-decoration: none; margin-right: auto; }
.mast nav { display: flex; align-items: baseline; gap: 1.25rem; }
.mast nav a { color: var(--quiet); text-decoration: none; }
.mast nav a:hover, .mast nav a[aria-current] { color: var(--ink); }
.theme { border: 0; background: none; color: var(--quiet); cursor: pointer; padding: 0; align-self: center; }
.theme:hover { color: var(--ink); }
.theme svg { display: block; width: 15px; height: 15px; }

/* type */
h1.title { font-size: 2.4rem; line-height: 1.12; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .6rem; text-wrap: balance; }
.lead { font-size: 1.45em; line-height: 1.38; letter-spacing: -.012em; margin-bottom: .9em; text-wrap: pretty; }
.sub { font-size: 1.22em; line-height: 1.42; color: var(--ink-2); margin-bottom: 1.2em; text-wrap: pretty; }
h2 { font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin: 3.6rem 0 1.1rem; }
h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.3; margin: 0 0 .35rem; }
.quiet { color: var(--quiet); }
.after-list { margin-top: .8rem; }

/* margin notes */
.ref { font-size: .62em; font-weight: 600; color: var(--red); vertical-align: .55em; line-height: 0; margin-left: .08em; text-decoration: none; font-variant-numeric: lining-nums; }
.note { float: right; clear: right; width: var(--note); margin: .35rem 0 1.4rem; font-size: .76rem; line-height: 1.5; color: var(--quiet); }
.note .n { color: var(--red); font-weight: 600; margin-right: .3em; font-variant-numeric: lining-nums; }
.note b { color: var(--ink-2); font-weight: 600; }
.note img { margin-bottom: .55rem; border-radius: 2px; }
.note a { color: var(--ink-2); }
.note.lit, .ref.lit { color: var(--ink); }
.note.lit .n { background: var(--hl); }
.portrait { aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 70%; }
.big-num { display: block; font-size: 2.4rem; line-height: 1.05; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: lining-nums; margin-bottom: .15rem; }
.note .big-num + .big-num { margin-top: .8rem; }
.cv { display: grid; grid-template-columns: max-content 1fr; gap: .12rem .7rem; margin-top: .4rem; font-variant-numeric: lining-nums tabular-nums; }
.cv > :nth-child(even) { color: var(--ink-2); }
/* a note written inside its paragraph, right after its number: it floats out into the margin,
   level with the line that references it, and is read in the right place */
p > .note, li > .note { display: block; margin-right: calc(-1 * (var(--note) + var(--gap))); font-style: normal; font-weight: 400; letter-spacing: 0; }
.lead > .note { margin-top: -.6rem; }
.note picture, .note img { display: block; }
/* a pair that keeps its note beside it (lists of entries) */
.row { display: flow-root; }

/* lists with the year (or number) hanging in the left margin */
.dated { list-style: none; margin: 0; padding: 0; }
.dated li { position: relative; padding: .28rem 0; }
.dated .yr { position: absolute; right: calc(100% + 1.1rem); top: .52rem; font-size: .8rem; color: var(--quiet); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.dated .what { color: var(--ink-2); }

/* project entries on the projects page */
.entry { position: relative; margin-bottom: 1.6rem; }
.entry .yr { position: absolute; right: calc(100% + 1.1rem); top: .45rem; font-size: .8rem; color: var(--quiet); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.entry h3 a { text-decoration-thickness: 1.5px; }
.entry p { color: var(--ink-2); margin: 0; }
.entry .kind { font-size: .8rem; color: var(--quiet); margin-top: .2rem; }

/* project pages */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1.2rem; font-size: .85rem; color: var(--ink-2); margin: 1.4rem 0 2.2rem; padding: .9rem 0; border-block: 1px solid var(--rule); }
.facts dt { color: var(--quiet); }
.facts dd { margin: 0; }
.facts dd a + a::before { content: "·"; display: inline-block; margin: 0 .4em; color: var(--quiet); }
figure { margin: 0; }
figure.wide { margin: 2.2rem 0 2.6rem; clear: both; }
figure.wide img, figure.wide video { width: 100%; border-radius: 2px; }
figure.wide figcaption, figure.inline figcaption { font-size: .76rem; color: var(--quiet); margin-top: .55rem; max-width: var(--col); }
figure.inline { margin: 1.8rem 0 2rem; }
figure.inline img { border-radius: 2px; }
.rules { padding-left: 1.1em; margin: 0 0 1.1em; }
.rules li { margin: .2em 0; }
.next { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--quiet); clear: both; }

/* screenshots that follow the theme */
.only-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .only-light { display: none; } :root:not([data-theme="light"]) .only-dark { display: block; } }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }

/* 1BRC timings */
.bars { list-style: none; margin: 1.2rem 0 .4rem; padding: 0; font-size: .82rem; font-variant-numeric: lining-nums tabular-nums; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 4rem; gap: .1rem .8rem; align-items: center; margin-bottom: .55rem; color: var(--ink-2); }
.bars .bl { grid-column: 1 / -1; }
.bars .bar { height: .5rem; background: color-mix(in srgb, var(--ink) 22%, transparent); width: calc(var(--w) * 100%); border-radius: 1px; }
.bars .best .bar { background: var(--red); }
.bars .base .bar { background: none; border: 1px dashed var(--quiet); }
.bars .bv { text-align: right; color: var(--ink); }
.chart figcaption { font-size: .76rem; color: var(--quiet); }

/* writing page: a series and its contents */
.series-title { font-size: 1.55rem; line-height: 1.25; font-weight: 600; letter-spacing: -.012em; margin: 0 0 .5rem; text-wrap: balance; }
.contents { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.contents li { position: relative; padding: .22rem 0; }
.contents .num { position: absolute; right: calc(100% + 1.1rem); top: .46rem; font-size: .8rem; color: var(--quiet); font-variant-numeric: lining-nums tabular-nums; }
.wip { font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--red); vertical-align: .25em; margin-left: .4rem; }

/* bookshelf */
.books { list-style: none; margin: 0; padding: 0; }
.books li { padding: .18rem 0; }
.books cite { font-style: italic; }
.books .by { color: var(--quiet); }
.count { color: var(--quiet); font-weight: 400; letter-spacing: 0; margin-left: .5rem; font-variant-numeric: lining-nums; }
.shelf-index a { display: inline-block; margin-right: .6rem; }

/* footer */
.foot { display: flex; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; margin-top: 4rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); font-size: .85rem; color: var(--quiet); max-width: var(--col); clear: both; }
.foot a { color: var(--ink-2); }

/* narrow screens: notes drop in under their paragraph, margin labels move inline */
@media (max-width: 62rem) {
  :root { --text: 18px; }
  .page { padding: 2.25rem 0 4rem; }
  .mast { margin-bottom: 2.75rem; }
  .pair { display: flex; flex-direction: column-reverse; }
  .row { display: flex; flex-direction: column-reverse; }
  .note { float: none; width: auto; margin: -.3rem 0 1.5rem; padding-left: .9rem; border-left: 2px solid var(--rule); }
  p > .note, li > .note { margin: .8rem 0 .4rem; line-height: 1.5; }
  .lead > .note { margin-top: 1rem; }
  .portrait-note { border-left: 0; padding-left: 0; margin-bottom: 1.2rem; }
  .page .portrait-note img { width: 6.5rem; aspect-ratio: 1; border-radius: 50%; object-position: 50% 60%; }
  .row { margin-bottom: 2rem; }
  .row .entry { margin-bottom: 0; }
  .row .note { margin: .7rem 0 0; }
  .note img { max-width: 17rem; }
  .lead { font-size: 1.3em; }
  .dated .yr, .contents .num { position: static; margin-right: .5rem; }
  .entry .yr { position: static; display: block; margin-bottom: .1rem; }
  h1.title { font-size: 1.9rem; }
  .big-num { font-size: 1.9rem; }
}
@media print { .mast nav, .theme { display: none; } .note { color: #444; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.contents a, .books a, .shelf-index a { text-decoration-color: var(--rule); }
.contents a:hover { text-decoration-color: var(--red); }
