/* 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) + Inter (body) + JetBrains Mono (labels) + Space Grotesk (specials)
*/

: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: "Space Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --inter: "Inter", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", 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: "Space Grotesk", -apple-system, system-ui, sans-serif;
}
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: 11px;
  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: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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;
}
.b-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  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: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 18px;
}
.b-index-head h1 {
  font-family: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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;
  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: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(242, 244, 248, 0.55);
  cursor: pointer;
  border-radius: 999px;
  transition: color 380ms cubic-bezier(0.32, 0.72, 0, 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-hint {
  display: inline-block;
  margin-left: 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  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 {
  border-top: 1px solid var(--line);
  margin-bottom: 96px;
}
.b-post-card {
  display: block;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}
/* 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: 10px;
  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: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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); max-width: 60ch; margin-top: 4px; }
.b-meal { margin-top: 8px; }
.b-meal p { margin-bottom: 1.2em; font-size: 16px; line-height: 1.65; color: var(--fg); }
.b-meal em { font-family: "Space Grotesk", sans-serif; 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: 11px;
  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 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 24px;
}
.post-header .eyebrow .tag { color: var(--accent); }
.post-header .eyebrow .sep { margin: 0 8px; opacity: 0.5; }
.post-header h1 {
  font-family: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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: 11px;
  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: 10px;
}
.post-footer .next .title {
  display: block;
  font-family: "Space Grotesk", -apple-system, system-ui, sans-serif;
  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); }

@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: 28px 0; }
}
