/* 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:       #697067;
  --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;
}

: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: 1.6;
  -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; } }

.wordmark { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .25rem; }
.wordmark a { text-decoration: none; }
.wordmark-sub {
  font-family: var(--mono);
  font-size: .75rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.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: .8125rem;
  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: .6875rem;
  line-height: 1.7;
  color: var(--faint);
}
.railmeta a { text-decoration: none; color: var(--muted); }
.railmeta a:hover { color: var(--accent); }

.themebtn {
  font-family: var(--mono);
  font-size: .6875rem;
  line-height: 1.7;
  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: .75rem;
  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: .6875rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  margin: 0 0 .75rem;
}

h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.375rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  text-wrap: balance;
  margin: 0 0 1rem;
}
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.005em; text-wrap: balance; margin: 0 0 .75rem; }

.lede { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.65; margin: 0 0 2rem; }
.kicker { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin: 0 0 1.5rem; }

.prose { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.72; }
.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: .8125rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .875rem 1rem;
  overflow-x: auto;
}
.prose img { max-width: 100%; height: auto; }

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

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

.spec { width: 100%; border-collapse: collapse; font-size: .875rem; }
.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: .75rem;
  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); } }

.row-when {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: .2rem;
}
.row-type {
  display: block;
  font-family: var(--mono);
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent);
  margin-top: .2rem;
}
.row-title { font-weight: 500; margin: 0 0 .2rem; }
.row-title a { text-decoration: none; }
.row-title a:hover { color: var(--accent); }
.row-note { font-family: var(--serif); font-size: .9375rem; color: var(--muted); margin: 0; }

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

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: .625rem;
  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: 1.25rem;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.metric-l { font-family: var(--mono); font-size: .625rem; line-height: 1.4; color: var(--faint); }

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

.cards { display: grid; gap: 1rem; }
@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; }
.card-note { font-family: var(--serif); font-size: .9375rem; color: var(--muted); margin: 0; }
.card-foot { margin: auto 0 0; }
.card-quiet { background: transparent; border-style: dashed; }

.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.chip {
  font-family: var(--mono);
  font-size: .625rem;
  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: .75rem;
  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: .75rem;
  color: var(--faint);
}
.footnav a { color: var(--muted); text-decoration: none; }
.footnav a:hover { color: var(--accent); }
.footnav .spacer { margin-left: auto; }

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