/* neerdpatel.com
   One face (XCharter, the resume's face), one ink, one accent. The accent is a redline: it marks
   up the drawing (balloons, the "now" line, link underlines) and does nothing else.
   Line meanings follow drawing practice: solid is time spent, dashed carries on past today,
   a chain line is the reference (today). Rules separate; there are no boxes, shadows or glass.
   Chart positions live in chart.css, written by build.py. */

@font-face { font-family: "XCharter"; src: url("/fonts/xcharter-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "XCharter"; src: url("/fonts/xcharter-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "XCharter"; src: url("/fonts/xcharter-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
/* A metric-matched fallback, so the swap to XCharter doesn't shift the layout. */
@font-face { font-family: "XCharter fallback"; src: local("Georgia"); size-adjust: 104%; ascent-override: 92%; descent-override: 24%; }

:root {
  color-scheme: light dark;
  --paper: light-dark(oklch(97.8% 0.003 250), oklch(17% 0.012 255));
  --ink: light-dark(oklch(21% 0.016 262), oklch(93.5% 0.005 250));
  --ink-2: light-dark(oklch(42% 0.016 262), oklch(76% 0.01 255));
  --rule: light-dark(oklch(85% 0.007 260), oklch(33% 0.012 255));
  --mark: light-dark(oklch(51% 0.19 28), oklch(73% 0.15 32));
  --face: "XCharter", "XCharter fallback", Charter, "Bitstream Charter", Georgia, serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --wide: 74rem;
  --text: 40rem;
}

*, *::before, *::after { 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 1.125rem/1.56 var(--face);
  font-variant-numeric: lining-nums proportional-nums;
  font-kerning: normal;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--mark); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { color: var(--mark); }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; border-radius: 1px; }

/* For keyboards: hidden until focused, then drawn inside the page's top-left margin. */
.skip { position: absolute; left: var(--gutter); top: max(8px, env(safe-area-inset-top)); z-index: 5; padding: 0.5rem 0.75rem; background: var(--paper); border: 2px solid var(--mark); font-weight: 700; font-size: 1rem; }
.skip:not(:focus) { width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.mast, main, .colophon { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* --- masthead: the name, said large once */
.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem;
  grid-template-areas: "name photo" "lede lede" "links links";
  column-gap: 1.25rem;
  padding-top: max(2.5rem, env(safe-area-inset-top));
  padding-bottom: 2.5rem;
}
.mast h1 {
  grid-area: name;
  align-self: end;
  margin: 0;
  font-size: clamp(2.7rem, 1.2rem + 7.4vw, 8rem);
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.portrait { grid-area: photo; align-self: end; }
.portrait img { display: block; width: 100%; height: auto; }
.lede { grid-area: lede; max-width: 36rem; margin: 1.4rem 0 1rem; font-size: 1.25rem; line-height: 1.5; }
.elsewhere { grid-area: links; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }

@media (min-width: 720px) {
  .mast { grid-template-columns: minmax(0, 1fr) 13rem; grid-template-areas: "name photo" "lede photo" "links photo"; column-gap: 3rem; padding-top: max(4.5rem, env(safe-area-inset-top)); padding-bottom: 4rem; }
  .mast h1 { align-self: start; }
  .lede { margin-top: 1.75rem; }
}

/* --- Fig. 1: the schedule */
.profile { margin: 0 0 4.5rem; container-type: inline-size; }
.profile figcaption { max-width: var(--text); margin-bottom: 1.5rem; color: var(--ink-2); font-size: 1rem; }
.fig { color: var(--ink); font-weight: 700; margin-right: 0.35em; font-variant-numeric: lining-nums; }

.chart {
  display: grid;
  font-variant-numeric: lining-nums tabular-nums;
  position: relative;
}
.axis {
  grid-column: 2 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: subgrid;
  padding-bottom: 6px;
  /* one tick per month along the axis's foot */
  background: repeating-linear-gradient(to right, var(--rule) 0 1px, transparent 1px calc(100% / var(--months, 68))) left bottom / 100% 5px no-repeat;
  border-bottom: 1px solid var(--ink-2);
}
.tick { padding: 0 0 0.1rem 0.3rem; border-left: 1px solid var(--ink-2); font-size: 0.8rem; color: var(--ink-2); }
.y2021 { display: none; }

.tracks { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; margin: 0; padding: 0; list-style: none; }
.track { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding: 0.7rem 0 0.8rem; border-bottom: 1px solid var(--rule); }
.tname { grid-column: 1 / -1; margin: 0 0 0.35rem; font-size: 0.95rem; font-weight: 700; font-variant-caps: small-caps; letter-spacing: 0.03em; }
.items { grid-column: 2 / -1; display: grid; grid-template-columns: subgrid; row-gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.item { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }
.what { grid-row: 1; position: relative; z-index: 2; margin: 0; padding-right: 0.5rem; font-size: 0.95rem; line-height: 1.3; }
/* Labels stop at today's line (chart.css), so no line ever runs through lettering. */
.what .when { display: inline-block; color: var(--ink-2); font-size: 0.85rem; }

/* A span of time: a 2 px line with a short tick at each end, as a drawing marks an extent. */
.line, .ahead { grid-row: 2; align-self: center; height: 9px; margin-top: 3px; transform-origin: left center; }
.line {
  background: linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat;
  border-inline: 1.5px solid var(--ink);
}
/* Still going: the line carries on dashed past today, with no end tick. */
.ahead { background: repeating-linear-gradient(to right, var(--ink-2) 0 6px, transparent 6px 10px) left center / 100% 2px no-repeat; }
.item:has(.ahead) .line { border-right: 0; }
/* An event after the span it belongs to: a dotted leader out to its balloon. */
.lead { grid-row: 2; align-self: center; height: 9px; margin-top: 3px; transform-origin: left center; background: repeating-linear-gradient(to right, var(--ink-2) 0 2px, transparent 2px 6px) left center / 100% 2px no-repeat; }

/* Pointing at one span lifts it and quiets the rest. */
.item :is(.line, .ahead, .lead) { transition: opacity 160ms var(--ease); }
.chart:has(.item:hover) .item:not(:hover) :is(.line, .ahead, .lead) { opacity: 0.3; }
.item:hover .line { background-image: linear-gradient(var(--mark), var(--mark)); border-color: var(--mark); }

/* A milestone: a small diamond on the line, as a schedule marks one, named in the row's label. */
.ms {
  grid-row: 2;
  justify-self: center;
  align-self: center;
  z-index: 1;
  width: 6px;
  height: 6px;
  margin-top: 3px;
  background: var(--mark);
  transform: rotate(45deg);
}
.ms-note { display: inline-block; color: var(--mark); font-size: 0.85rem; }
.ms-glyph { display: inline-block; width: 6px; height: 6px; margin: 0 0.4em 0.1em 0.25em; background: var(--mark); transform: rotate(45deg); vertical-align: middle; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Today: a chain line (long dash, dot), the drawing's line for a reference. */
.chart::after {
  content: "";
  justify-self: end;
  width: 1.5px;
  background: repeating-linear-gradient(to bottom, var(--mark) 0 12px, transparent 12px 15px, var(--mark) 15px 17px, transparent 17px 20px);
  pointer-events: none;
}
.now { margin: 0.4rem 0 0; padding-right: 0.45rem; text-align: end; color: var(--mark); font-size: 0.85rem; font-weight: 700; line-height: 1.25; }

@container (min-width: 44rem) {
  .y2021 { display: block; }
  .ms { width: 9px; height: 9px; }
  .tname { grid-column: 1; grid-row: 1; margin: 0; padding-right: 1rem; }
  .items { grid-row: 1; }
  .track { padding: 0.8rem 0; }
}

/* It draws once on arrival, left to right in date order, in about two seconds; then it's still. */
@media (prefers-reduced-motion: no-preference) {
  .line { animation: draw 600ms var(--ease) both; animation-delay: calc(var(--s, 0) * 22ms); }
  .ahead { animation: draw 500ms var(--ease) both; animation-delay: calc(var(--s, 0) * 22ms + 350ms); }
  .lead { animation: draw 400ms var(--ease) both; animation-delay: calc(var(--s, 0) * 22ms + 300ms); }
  .ms { animation: pop 240ms var(--ease) both; animation-delay: calc(var(--m, 0) * 22ms + 450ms); }
  .chart::after { animation: rise 700ms var(--ease) both; animation-delay: 1.3s; transform-origin: center bottom; }
}
@keyframes draw { from { transform: scaleX(0); } }
@keyframes pop { from { opacity: 0; transform: rotate(45deg) scale(0.4); } }
@keyframes rise { from { transform: scaleY(0); } }

/* --- Fig. 2: deviation of each flight's simulated apogee from its log */
.project { padding: 2.25rem 0 3rem; border-top: 1px solid var(--rule); }
.project h2 { margin: 0 0 0.75rem; font-size: 1.65rem; line-height: 1.15; letter-spacing: -0.01em; }
.project h3 { margin: 2rem 0 0.5rem; font-size: 1.3rem; line-height: 1.25; }
.intro, .prose { max-width: var(--text); }
.deviation { margin: 1.75rem 0 1rem; container-type: inline-size; }
.deviation figcaption { max-width: var(--text); margin-bottom: 1.25rem; color: var(--ink-2); font-size: 1rem; }
.source { margin: 0.9rem 0 0; color: var(--ink-2); font-size: 0.88rem; }
.dev { display: grid; position: relative; font-variant-numeric: lining-nums tabular-nums; grid-template-rows: auto auto; }
.dev-axis { grid-column: 2 / -1; grid-row: 1; display: grid; grid-template-columns: subgrid; padding-bottom: 5px; border-bottom: 1px solid var(--ink-2); }
.dtick { padding-left: 0.3rem; border-left: 1px solid var(--ink-2); font-size: 0.8rem; color: var(--ink-2); }
.band { grid-row: 2; align-self: stretch; background: color-mix(in oklch, var(--mark) 9%, transparent); border-inline: 1px dashed color-mix(in oklch, var(--mark) 55%, transparent); }
.dev::after { content: ""; grid-row: 1 / -1; justify-self: end; width: 1.5px; background: var(--ink); }
.dev-rows { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: subgrid; margin: 0; padding: 0.3rem 0 0; list-style: none; }
.drow { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; margin: 0; padding: 0.3rem 0; border-bottom: 1px solid var(--rule); }
.dname { grid-column: 1 / -1; grid-row: 1; position: relative; z-index: 1; margin: 0 0 0.2rem; font-size: 0.9rem; line-height: 1.3; }
/* On narrow screens the name sits over the band and the zero line; it breaks them, as lettering does on a drawing. */
.dlabel { background: var(--paper); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.dval { color: var(--ink-2); }
.dbar { grid-row: 2; height: 2px; background: var(--ink); }
.dend { grid-row: 2; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ink); }
/* A group's heading row: which way its flights were compared, and their average miss. */
.dgroup { grid-column: 1 / -1; margin: 0; padding: 1rem 0 0.35rem; border-bottom: 1px solid var(--ink-2); }
.dgroup:first-child { padding-top: 0.15rem; }
.dgroup p { position: relative; z-index: 1; margin: 0; font-size: 0.9rem; line-height: 1.3; color: var(--ink-2); }
.dglabel { background: var(--paper); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.dgname { color: var(--ink); font-weight: 700; font-variant-caps: small-caps; letter-spacing: 0.03em; }
@container (min-width: 40rem) {
  .dname { grid-column: 1; margin: 0; padding-right: 1rem; }
  .dbar, .dend { grid-row: 1; }
}

/* --- the sections below: a heading column and a text column, separated by rules */
.record, .bench { padding: 2.25rem 0 3rem; border-top: 1px solid var(--rule); }
.record h2, .bench h2 { margin: 0 0 1rem; font-size: 1.65rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.record-body { max-width: var(--text); }
.record-body > :first-child { margin-top: 0; }
.meta { color: var(--ink-2); }
p { margin: 0 0 1rem; }
ul { margin: 0 0 1rem; padding-left: 1.15rem; }
li { margin-bottom: 0.55rem; }
li::marker { color: var(--ink-2); }
.work { margin-bottom: 1.75rem; }
.work h3 { margin: 0 0 0.35rem; font-size: 1.25rem; line-height: 1.25; }
cite { font-style: italic; }

@media (min-width: 900px) {
  .record { display: grid; grid-template-columns: 16rem minmax(0, var(--text)); column-gap: 3rem; }
  .record h2 { margin: 0; }
}

/* --- photographs: justified rows. Each plate grows by its aspect ratio from a basis set by it,
   so the photos sharing a row share one height, and none is ever cropped. */
.plates { display: grid; gap: 1.5rem; margin-top: 1.25rem; }
/* Phones: one photo a row, full width. */
.plate-row { display: grid; gap: 1.5rem; }
.plate { margin: 0; min-width: 0; }
.ar-1 { --ar: 1; }
.ar-34 { --ar: 0.75; }
.ar-142 { --ar: 1.417; }
/* Wider: each row fills the width, and each photo takes width in proportion to its aspect ratio,
   so every photo in a row is the same height. Two rows, chosen so neither leaves a gap. */
@media (min-width: 720px) {
  .plate-row { display: flex; align-items: flex-start; }
  .plate { flex: var(--ar) 1 0; }
}
.plate img { display: block; width: 100%; height: auto; }
.plate figcaption { margin-top: 0.5rem; font-size: 0.92rem; color: var(--ink-2); line-height: 1.4; }

/* --- the colophon */
.colophon { padding-top: 1.25rem; padding-bottom: max(2.5rem, env(safe-area-inset-bottom)); color: var(--ink-2); font-size: 0.92rem; }
.colophon p { max-width: var(--text); margin: 0 0 0.4rem; }
.colophon p:first-child { border-top: 2px solid var(--ink); padding-top: 1rem; }

@media print {
  .skip { display: none; }
  .line, .ahead, .lead, .ms, .chart::after { animation: none; }
}
