/* ankitskgoyal.com — one stylesheet, no build step.
   Tokens first; every component reads from them. Light is the default for every
   visitor; dark is opt-in via the toggle and remembered in localStorage. */

:root {
  --ground:      #F4F5F2;
  --surface:     #FFFFFF;
  --ink:         #191C18;
  --muted:       #5C635A;
  --faint:       #5F665C;
  --rule:        #DFE2DB;
  --rule-strong: #C4C9BE;
  --accent:      #7E6318;
  --accent-soft: #EFE7D0;

  --sans:  "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 64ch;
  --rail: 15rem;

  /* type scale */
  --t-3xl: clamp(1.75rem, 1.3rem + 1.9vw, 2.375rem);  /* h1 — unchanged */
  --t-2xl: 1.375rem;    /* 22px — section headings */
  --t-xl:  1.1875rem;   /* 19px — lede */
  --t-lg:  1.0625rem;   /* 17px — prose, role titles */
  --t-md:  0.9375rem;   /* 15px — notes, spec tables */
  --t-sm:  0.8125rem;   /* 13px — nav, card footers */
  --t-xs:  0.75rem;     /* 12px — mono labels, dates, eyebrows */
  --t-2xs: 0.6875rem;   /* 11px — rail meta. Hard floor. */

  /* leading */
  --lh-tight:  1.15;    /* display figures, h1 */
  --lh-snug:   1.4;     /* small mono labels */
  --lh-normal: 1.5;     /* UI text */
  --lh-prose:  1.65;    /* serif body */
}

:root[data-theme="dark"] {
  --ground:      #121410;
  --surface:     #191C18;
  --ink:         #E9EBE5;
  --muted:       #9AA096;
  --faint:       #8A9086;
  --rule:        #2A2E27;
  --rule-strong: #3C4239;
  --accent:      #C6A44E;
  --accent-soft: #2E2916;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- frame ---------- */

.frame {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}
@media (max-width: 61.99rem) {
  .frame { max-width: 46rem; }
}
@media (min-width: 62rem) {
  .frame { grid-template-columns: var(--rail) minmax(0, 1fr); gap: 4rem; padding-top: 4.5rem; }
}

.frame.solo { max-width: 48rem; }
@media (min-width: 62rem) {
  .frame.solo { grid-template-columns: minmax(0, 1fr); }
}

.col { max-width: var(--measure); }

/* ---------- rail ---------- */

.rail { align-self: start; }
@media (min-width: 62rem) { .rail { position: sticky; top: 4.5rem; } }

.avatar {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  margin: 0 0 .75rem;
}

.wordmark { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.01em; margin: 0 0 .25rem; }
.wordmark a { text-decoration: none; }
.wordmark-sub {
  text-wrap: pretty;
  font-family: var(--mono);
  font-size: var(--t-xs);
  line-height: var(--lh-snug);
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.wordmark-sub .nb { white-space: nowrap; }

.railnav { display: flex; flex-wrap: wrap; gap: .125rem 1rem; margin-bottom: 1.75rem; }
@media (min-width: 62rem) { .railnav { flex-direction: column; gap: .125rem; } }
.railnav a {
  font-family: var(--mono);
  font-size: var(--t-sm);
  text-decoration: none;
  color: var(--muted);
  padding: .15rem 0;
}
.railnav a:hover { color: var(--ink); }
.railnav a[aria-current="page"] { color: var(--ink); }
.railnav a[aria-current="page"]::before { content: "\2192 "; color: var(--accent); }

.railmeta {
  border-top: 1px solid var(--rule);
  padding-top: .875rem;
  font-family: var(--mono);
  font-size: var(--t-2xs);
  line-height: var(--lh-snug);
  color: var(--faint);
}
.railmeta a { text-decoration: none; color: var(--muted); }
.railmeta a:hover { color: var(--accent); }

.themebtn {
  font-family: var(--mono);
  font-size: var(--t-2xs);
  line-height: var(--lh-snug);
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 .35rem;
  color: var(--muted);
  cursor: pointer;
  display: block;
}
.themebtn:hover { color: var(--accent); }
.themebtn .dot { display: inline-block; width: .6rem; }

/* Primary action link — used for the resume PDF. Same visual family as the
   theme button: mono, 1px border. Accent text so it reads as the one thing
   on the page you can act on. */
.action {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: .02em;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: .5rem .875rem;
  margin: -.5rem 0 2.25rem;
}
.action:hover { border-color: var(--accent); }

/* ---------- type ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-2xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  margin: 0 0 .75rem;
}

h1 {
  font-size: var(--t-3xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.02em;
  text-wrap: balance;
  margin: 0 0 1rem;
}
h2 { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -.005em; text-wrap: balance; margin: 0 0 .75rem; }

.lede { font-family: var(--serif); font-size: var(--t-xl); line-height: var(--lh-prose); margin: 0 0 2rem; }
.kicker { font-family: var(--mono); font-size: var(--t-xs); color: var(--muted); margin: 0 0 1.5rem; }

.prose { font-family: var(--serif); font-size: var(--t-lg); line-height: var(--lh-prose); }
.prose p { margin: 0 0 1.15rem; }
.prose p:last-child { margin-bottom: 0; }
.prose h2 { font-family: var(--sans); margin: 2rem 0 .6rem; }
.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.prose pre {
  font-family: var(--mono);
  font-size: var(--t-sm);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .875rem 1rem;
  overflow-x: auto;
}
.prose img { max-width: 100%; height: auto; }

figure { margin: 2rem 0; }
figure img { display: block; width: 100%; height: auto; border-radius: 2px; }
figcaption {
  font-family: var(--mono);
  font-size: var(--t-2xs);
  line-height: var(--lh-snug);
  color: var(--faint);
  margin-top: .5rem;
}

/* Screen recordings. The explicit width/height on the <video> element plus
   width:100%/height:auto here reserve the aspect ratio before the poster loads, so the
   text below does not jump when it arrives. Both halves are needed; neither alone. */
.demo { margin: 2rem 0; }
.demo video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--surface);
}
.demo figcaption {
  font-family: var(--mono);
  font-size: var(--t-2xs);
  line-height: var(--lh-snug);
  color: var(--faint);
  margin-top: .5rem;
}

.section { border-top: 1px solid var(--rule); padding-top: 1.75rem; margin-top: 0.9375rem; }

/* ---------- spec table ---------- */

.spec { width: 100%; border-collapse: collapse; font-size: var(--t-md); }
.spec th, .spec td {
  text-align: left;
  vertical-align: baseline;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}
.spec th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--t-xs);
  color: var(--faint);
  width: 9.5rem;
  padding-right: 1rem;
  white-space: nowrap;
}
.spec td { font-variant-numeric: tabular-nums; }

@media (max-width: 39.99rem) {
  .spec th, .spec td { display: block; width: auto; padding-right: 0; }
  .spec th { border-bottom: 0; padding-bottom: .15rem; }
  .spec td { padding-top: 0; }
}
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }

/* ---------- rows ---------- */

.rows { display: flex; flex-direction: column; }
.row { display: grid; gap: .15rem 1.25rem; padding: 1.15rem 0; border-bottom: 1px solid var(--rule); }
.row:first-child { border-top: 1px solid var(--rule); }
@media (min-width: 40rem) { .row { grid-template-columns: 7.5rem minmax(0, 1fr); } }
.rows-plain .row { grid-template-columns: minmax(0, 1fr); }

.row-when {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: .2rem;
}
.row-type {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-2xs);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent);
  margin-top: .2rem;
}
.row-title { font-size: var(--t-lg); font-weight: 600; margin: 0 0 .2rem; }
.row-title a,
.row-link .row-title span {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}
.row-title a:hover { text-decoration-color: var(--accent); }

.row-link {
  display: block;
  text-decoration: none;
  color: inherit;
  margin: -1.15rem -0.75rem;
  padding: 1.15rem 0.75rem;
  border-radius: 2px;
}
.row-link:hover { background: var(--surface); }
.row-link:hover .row-title span { text-decoration-color: var(--accent); }
.row-note { font-family: var(--serif); font-size: var(--t-md); color: var(--ink); margin: 0; }

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-2xs);
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: .15rem .45rem;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--muted);
  vertical-align: .1em;
}
.pill-live { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- metrics strip (resume + case studies only) ---------- */

.metrics { display: grid; gap: .75rem; margin: 0 0 1rem; }
@media (min-width: 34rem) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metric {
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--surface);
  padding: .8rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.metric-n {
  font-size: var(--t-2xl);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}
.metric-l { font-family: var(--mono); font-size: var(--t-2xs); line-height: var(--lh-snug); color: var(--faint); }

/* ---------- project cards (the only cards on the site) ---------- */

.cards { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 44rem) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--surface);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.card h2 { margin: 0; }
/* Sans, not serif. A serif needs a WIDER measure than a sans, and this one sits in a
   260px column at roughly 32 characters a line -- the narrowest place on the site had
   the face that tolerates it least. .row-note stays serif: much wider column. */
.card-note {
  font-family: var(--sans);
  font-size: var(--t-md);
  line-height: var(--lh-normal);
  color: var(--muted);
  margin: 0;
}
.card-foot { margin: auto 0 0; font-size: var(--t-sm); }
.card-foot a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.card-quiet { background: transparent; border-style: dashed; }

.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.chip {
  font-family: var(--mono);
  font-size: var(--t-2xs);
  padding: .1rem .4rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--faint);
}

/* ---------- breadcrumbs (nested pages only) ---------- */

.crumbs { margin: 0 0 1.5rem; }
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .45rem;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--faint);
}
.crumbs li { display: flex; align-items: baseline; gap: .45rem; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--rule-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current="page"] { color: var(--ink); }

/* ---------- essay footer ---------- */

.essayfoot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.footnav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  align-items: baseline;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--faint);
}
.footnav a { color: var(--muted); text-decoration: none; }
.footnav a:hover { color: var(--accent); }
.footnav .spacer { margin-left: auto; }

.react { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; }
.react-q { font-family:var(--mono); font-size:var(--t-2xs); color:var(--faint);
           margin-right:.35rem; }
.rx { display:inline-flex; align-items:center; gap:.35rem;
      font-family:var(--mono); font-size:var(--t-2xs); line-height:var(--lh-snug);
      padding:.34rem .55rem; border:1px solid var(--rule); border-radius:2px;
      background:transparent; color:var(--muted); cursor:pointer; }
.rx:hover { border-color:var(--rule-strong); color:var(--ink); }
.rx .em { font-size:var(--t-sm); line-height:1; }
.rx .ct { font-variant-numeric:tabular-nums; color:var(--faint);
          border-left:1px solid var(--rule); padding-left:.35rem; }
.rx[aria-pressed="true"] { border-color:var(--accent); color:var(--accent);
                           background:var(--accent-soft); }
.rx[aria-pressed="true"] .ct { color:var(--accent); border-color:var(--accent); }

.snote { border-top:1px solid var(--rule); padding-top:1rem; }
.snote > summary { font-family:var(--mono); font-size:var(--t-xs);
                   color:var(--muted); cursor:pointer; list-style:none; }
.snote > summary::-webkit-details-marker { display:none; }
.snote > summary::before { content:"▸ "; color:var(--accent); }
.snote[open] > summary::before { content:"▾ "; }
.snote > summary:hover { color:var(--ink); }

.sform { display:flex; flex-direction:column; gap:.6rem; margin-top:.9rem;
         max-width:34rem; }
.frow { display:grid; gap:.6rem; }
@media (min-width:30rem) { .frow { grid-template-columns:1fr 1fr; } }
.fl { display:flex; flex-direction:column; gap:.22rem; }
.fl > span { font-family:var(--mono); font-size:var(--t-2xs); color:var(--faint); }
.fi { font-family:var(--sans); font-size:var(--t-sm); color:var(--ink);
      background:var(--surface); border:1px solid var(--rule); border-radius:2px;
      padding:.4rem .5rem; width:100%; }
.fi:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
textarea.fi { resize:vertical; min-height:4.6rem; line-height:var(--lh-normal); }
.fbtn { align-self:flex-start; font-family:var(--mono); font-size:var(--t-xs);
        color:var(--accent); background:transparent; border:1px solid var(--accent);
        border-radius:2px; padding:.34rem .7rem; cursor:pointer; }
.fhint { font-family:var(--mono); font-size:var(--t-2xs); color:var(--faint); margin:0; }
.hp { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

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