/* nikhilballal.com / blog
   Editorial reading surface. One column, generous negative space,
   no cards, no decorative chrome. Built to be read.
   Brand stack: Instrument Serif (display) + Geist (body/specials) + JetBrains Mono (labels)
*/

:root {
  --bg: #06070C;
  --fg: #F2F4F8;
  --fg-2: rgba(242, 244, 248, 0.68);
  --fg-3: rgba(242, 244, 248, 0.42);
  --line: rgba(255, 255, 255, 0.09);
  --accent: #7AB6FF;
  --violet: #A78BFA;
  --gold: #C9A86A;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
body, p, li,
.b-index-head .lede,
.b-post-card .dek,
.post-body, .post-body p, .post-body li {
  font-family: var(--sans);
}
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--bg); }

/* layout container */
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* nav */
.b-nav {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}
.b-nav-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.b-nav a {
  color: var(--fg-2);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: color 200ms ease;
}
.b-nav a:hover { color: var(--accent); }
.b-nav .home {
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.025em;
  text-transform: none;
}
.b-nav .home .period { color: var(--accent); }

/* index page */
.b-index-head {
  padding: 96px 0 48px;
  text-align: center;
}
.b-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}
.b-eyebrow-row .eyebrow { margin-bottom: 0; }
.b-nb-mark { display: inline-flex; align-items: center; line-height: 0; }
.b-nb-mark svg { width: 40px; height: 40px; opacity: 0.92; }

.b-index-head .eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 18px;
}
.b-index-head h1 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.b-index-head h1 .period { color: var(--accent); font-style: normal; }
.b-index-head .lede {
  font-size: 17px;
  color: var(--fg-2);
  max-width: 52ch;
  margin: 0 auto;
  line-height: 1.55;
}

/* Toggle: Bites vs Whole Meal  -  liquid glass with sliding indicator */
.b-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px;
  margin: 8px 0 40px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 8px 28px rgba(0, 0, 0, 0.3),
    0 0 0 0 rgba(167, 139, 250, 0);
  isolation: isolate;
}
.b-toggle::before {
  /* Sliding glass pill behind the active label */
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: var(--indicator-w, 96px);
  height: calc(100% - 8px);
  transform: translate3d(var(--indicator-x, 4px), 0, 0);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(238, 240, 246, 0.88) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.15),
    0 8px 20px rgba(122, 182, 255, 0.18),
    0 0 24px rgba(167, 139, 250, 0.22);
  transition:
    transform 520ms cubic-bezier(0.32, 0.72, 0, 1),
    width 520ms cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 320ms ease;
  z-index: 0;
}
.b-toggle-btn {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  padding: 10px 22px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(242, 244, 248, 0.55);
  cursor: pointer;
  border-radius: 999px;
  /* release springs back past 1 by about half a percent, then settles */
  transition: color 380ms cubic-bezier(0.32, 0.72, 0, 1), transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.b-toggle-btn:active { transform: scale(0.94); transition: color 380ms cubic-bezier(0.32, 0.72, 0, 1), transform 120ms cubic-bezier(0.23, 1, 0.32, 1); }
.b-toggle-btn:hover:not(.is-active) { color: rgba(242, 244, 248, 0.95); }
.b-toggle-btn.is-active { color: #0c0d12; }

/* Subtle one-time breathe to draw the eye on first paint */
@keyframes b-toggle-breathe {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      inset 0 -1px 0 rgba(0, 0, 0, 0.3),
      0 8px 28px rgba(0, 0, 0, 0.3),
      0 0 0 0 rgba(167, 139, 250, 0);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      inset 0 -1px 0 rgba(0, 0, 0, 0.3),
      0 8px 28px rgba(0, 0, 0, 0.3),
      0 0 0 8px rgba(167, 139, 250, 0.10);
  }
}
.b-toggle.is-fresh { animation: b-toggle-breathe 2.8s ease-in-out 0.9s 2; }
@media (prefers-reduced-motion: reduce) {
  .b-toggle.is-fresh { animation: none; }
  .b-toggle::before { transition: none; }
  .b-toggle-btn, .b-toggle-btn:active { transform: none; transition: color 380ms cubic-bezier(0.32, 0.72, 0, 1); }
}

.b-toggle-hint {
  display: inline-block;
  margin-left: 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 400ms ease, transform 400ms ease;
}
.b-toggle-hint.is-visible { opacity: 1; transform: translateY(0); }

.b-list {
  margin: 44px 0 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.b-post-card {
  display: block;
  padding: 32px 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
/* Kill underlines on every link inside /blog/, defensively */
.b-list a,
.b-list a:hover,
.b-list a:visited,
.b-list a *,
.b-card-head,
.b-card-head:hover,
.b-card-head *,
.b-card-head h2,
.b-post-card .read,
.b-post-card .read:hover {
  text-decoration: none !important;
  text-decoration-line: none !important;
  border-bottom: 0;
}

.b-card-head {
  display: block;
  color: inherit;
  transition: padding-left 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.b-list[data-mode="bites"] .b-card-head:hover { padding-left: 8px; }
.b-post-card .meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 12px;
}
.b-post-card .meta .tag { color: var(--accent); }
.b-post-card .meta .sep { margin: 0 8px; opacity: 0.5; }
.b-post-card h2 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.022em;
  margin-bottom: 12px;
  color: var(--fg);
  transition: color 200ms ease;
}
.b-list[data-mode="bites"] .b-card-head:hover h2 { color: var(--accent); }
.b-post-card h2 .period { color: var(--accent); }
.b-bite, .b-meal { display: none; }
.b-list[data-mode="bites"] .b-bite { display: block; }
.b-list[data-mode="meal"] .b-meal { display: block; }
.b-bite { font-size: 15px; line-height: 1.55; color: var(--fg-2); margin-top: 4px; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.b-meal { margin-top: 8px; }
.b-meal p { margin-bottom: 1.2em; font-size: 16px; line-height: 1.65; color: var(--fg); text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.b-meal em { font-family: var(--sans); font-style: normal; font-weight: 500; }
.b-meal code { font-family: var(--mono); font-size: 0.86em; background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 3px; }
.b-meal pre { font-family: var(--mono); font-size: 12px; background: rgba(255,255,255,0.035); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; overflow-x: auto; margin: 1.2em 0; color: var(--fg-2); line-height: 1.55; }
.b-meal pre code { background: none; padding: 0; }
.b-meal ul, .b-meal ol { margin: 0.4em 0 1.2em 1.2em; }
.b-meal li { margin-bottom: 0.4em; }
.b-meal ul li::marker { color: var(--accent); }
.b-meal a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 200ms ease; }
.b-meal a:hover { border-bottom-color: rgba(122, 182, 255, 0.55); }
.b-meal-loading { color: var(--fg-3); font-size: 13px; font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; padding: 12px 0; }
.b-card-foot { margin-top: 14px; }
.b-post-card .dek {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 60ch;
}
.b-post-card .read {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.b-post-card .read:hover { opacity: 0.7; transform: translateX(2px); }

/* post page */
.post-header {
  padding: 80px 0 48px;
}
.post-header .eyebrow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--fg-3);
  margin-bottom: 24px;
}
.post-header .eyebrow .tag {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.post-header .eyebrow .sep { display: none; }
/* 500, not 450: with per-weight faces 450 always snapped to the Geist 500
   face. fonts-v2.css gives Geist a 300 700 range, where 450 would render
   lighter, so this asks for the weight it has always shown. */
.post-header .eyebrow time {
  color: var(--fg-2);
  font: 500 12px/1.4 var(--sans);
  letter-spacing: 0;
  text-transform: none;
}
.post-header .eyebrow time::before {
  content: "published on ";
  color: var(--fg-3);
}
.post-header .eyebrow time + span:not(.sep) {
  color: var(--fg-3);
  font: 500 12px/1.4 var(--sans);
  letter-spacing: 0;
  text-transform: none;
}
.post-header h1 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.post-header h1 .period { color: var(--accent); }
.post-header h1 .accent-violet { color: var(--violet); }

/* body prose */
.post-body {
  padding-bottom: 80px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--fg);
}
.post-body p { margin-bottom: 1.35em; }
.post-body p + p { text-indent: 0; }
.post-body em {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  color: var(--fg);
}
.post-body strong { font-weight: 600; color: var(--fg); }
.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 220ms ease;
}
.post-body a:hover { border-bottom-color: rgba(122, 182, 255, 0.55); }
.post-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--fg);
}
.post-body pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
  overflow-x: auto;
  margin: 1.6em 0;
  color: var(--fg-2);
}
.post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}
.post-body ul, .post-body ol {
  margin: 0.4em 0 1.4em 1.4em;
}
.post-body li { margin-bottom: 0.55em; padding-left: 0.2em; }
.post-body ul li::marker { color: var(--accent); }
.post-body ol li::marker { color: var(--accent); font-family: var(--mono); font-size: 0.85em; }
.post-body hr {
  border: none;
  width: 80px;
  height: 1px;
  background: var(--line);
  margin: 2.4em auto;
}
.post-body blockquote {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.16em;
  line-height: 1.45;
  color: var(--fg);
  margin: 1.8em 0;
  padding-left: 24px;
  border-left: 2px solid var(--violet);
}

/* post footer */
.post-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.post-footer a {
  color: var(--fg-2);
  text-decoration: none;
  transition: color 200ms ease;
}
.post-footer a:hover { color: var(--accent); }
.post-footer .next {
  text-align: right;
  max-width: 60%;
}
.post-footer .next .label {
  display: block;
  color: var(--fg-3);
  margin-bottom: 6px;
  font-size: 12px;
}
.post-footer .next .title {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  text-transform: none;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--fg);
}
.post-footer a:hover .next .title { color: var(--accent); }

/* Editorial article artwork */
.post-hero {
  margin: 0 0 48px;
}
.post-hero img {
  display: block;
  width: min(100%, 640px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f3efe4;
}

@media (max-width: 600px) {
  html, body { font-size: 16px; }
  .b-index-head { padding: 56px 0 32px; }
  .post-header { padding: 48px 0 32px; }
  .post-body { font-size: 17px; }
  .b-post-card { padding: 26px 22px; }
  .post-hero { margin-bottom: 36px; }
  .post-hero img { border-radius: 8px; }
}

/* =====================================================================
   v2 paper colourway - matches nikhilballal.com/v2 (bone + ink + orange)
   ===================================================================== */
:root {
  --bg: #f3efe4;
  --fg: #221f1a;
  --fg-2: rgba(34, 31, 26, 0.68);
  --fg-3: rgba(34, 31, 26, 0.64);   /* 4.7:1 on --bg; 0.62 is 4.43 and fails AA */
  --line: rgba(34, 31, 26, 0.14);
  --accent: #b3441a;                 /* text-safe orange: 4.86:1 on --bg (was #c64f1c, 4.03) */
  --violet: #6a52d0;
  --gold: #8a6d2e;
}
/* segmented toggle: paper field, ink active pill with bone text */
.b-toggle { background: rgba(34, 31, 26, 0.04); border-color: rgba(34, 31, 26, 0.12);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.b-toggle::before { background: var(--fg);
  box-shadow: 0 4px 14px rgba(34, 31, 26, 0.22); }
.b-toggle-btn { color: var(--fg-2); }
.b-toggle-btn:hover:not(.is-active) { color: rgba(34, 31, 26, 0.95); }
.b-toggle-btn.is-active { color: var(--bg); }
/* post cards: clean paper surface, ink hairline */
.b-post-card { background: #fbf8f1; border-color: rgba(34, 31, 26, 0.12);
  box-shadow: 0 18px 40px -28px rgba(72, 60, 36, 0.16); }
/* code on paper */
.b-meal code, .post-body code { background: rgba(34, 31, 26, 0.06); color: var(--fg); }
.b-meal pre, .post-body pre { background: rgba(34, 31, 26, 0.045); color: var(--fg-2); }
/* link hovers -> orange */
.b-meal a:hover, .post-body a:hover, .post-body a:hover { border-bottom-color: rgba(198, 79, 28, 0.6); }
/* dark theme-color meta cannot be reached from CSS; the bone bg + ink text now carry it */


/* Artwork on the writing index */
.b-card-art {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  margin-bottom: 24px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #0a0b10;
  box-shadow:
    0 22px 34px -22px rgba(44, 37, 25, 0.52),
    0 8px 16px -12px rgba(44, 37, 25, 0.30);
  transform: translateY(-1px);
  transition:
    transform 360ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.b-card-art--portrait {
  aspect-ratio: 4 / 3;
  background: #f3efe4;
}
.b-card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.b-card-art--portrait img {
  object-fit: contain;
}
.b-list[data-mode="bites"] .b-card-art:hover img {
  transform: scale(1.012);
}
.b-list[data-mode="bites"] .b-card-art:hover {
  transform: translateY(-3px);
  box-shadow:
    0 28px 42px -22px rgba(44, 37, 25, 0.56),
    0 12px 20px -14px rgba(44, 37, 25, 0.34);
}
@media (max-width: 600px) {
  .b-card-art {
    margin-bottom: 20px;
    border-radius: 10px;
  }
}

/* Read next: three posts from the same cluster, written by scripts/blog-links.mjs.
   Fills and spacing, no outlines. Meta uses --fg-2: --fg-3 is about 3.6:1 here. */
.read-next {
  margin: 48px 0 40px;
}
.read-next h2 {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.read-next ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.read-next a {
  display: block;
  padding: 16px 18px;
  border-radius: 12px;
  /* Tinted from the text colour, so the fill shows on the dark ground and on cream. */
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  color: var(--fg);
  text-decoration: none;
  transition: background 200ms ease;
}
.read-next a:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); }
.read-next a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.read-next .rn-meta {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.read-next .rn-title {
  display: block;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
/* Hover underlines rather than recolouring: the accent is under 4.5:1 on paper. */
.read-next a:hover .rn-title { text-decoration: underline; text-underline-offset: 3px; }

/* Plain links to every section, so no page is a dead end for readers or crawlers. */
.post-footer:has(+ .site-links) { padding-bottom: 20px; }
.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin: 0;
  padding: 0 0 72px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 200ms ease;
}
.site-links a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
.site-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


.b-index-head h1{font-size:clamp(1.3rem,5.8vw,4rem);white-space:nowrap;line-height:1.1;letter-spacing:-.035em}

/* Skip link: first tab stop on every blog page; jumps to <main id="main" tabindex="-1">. */
.skip {
  position: fixed; top: 10px; left: -9999px; z-index: 300;
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px;
  background: var(--fg); color: var(--bg); border-radius: 4px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
}
.skip:focus { left: 16px; }
main:focus { outline: none; }
