/* Vishal Bharti — portfolio. Fraunces for display, Inter Tight for text, one grid, lots of air. */

/* Metric-matched fallback so the swap to Fraunces barely moves the page. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
}

:root {
  --paper: #f7f6f2;
  --surface: #edebe5;
  --surface-2: #e4e1d9;
  --ink: #141414;
  --ink-2: #4a4945;
  --muted: #6b6a65;
  --rule: #dddad2;
  --rule-strong: #b9b5ab;   /* decorative only: portrait plate */
  --link-rule: #827f76;     /* 3.7:1 on paper: link underlines, diagram strokes */
  --sans: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Fraunces", "Fraunces Fallback", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --max: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
  --section: clamp(72px, 10vw, 140px);
  --radius: 4px;
  --shadow: 0 1px 2px rgba(20,20,20,.06), 0 14px 40px rgba(20,20,20,.10);
  /* Five-step type scale */
  --t-xs: .8125rem;
  --t-s: .9375rem;
  --t-m: 1.0625rem;
  --t-l: 1.25rem;
  --t-xl: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-m);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: var(--link-rule); transition: text-decoration-color .15s ease; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

h1, h2 { margin: 0; font-family: var(--serif); font-weight: 300; font-variation-settings: "opsz" 144; letter-spacing: -0.015em; line-height: 1.05; text-wrap: balance; }
h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
strong { font-weight: 600; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: var(--gutter); top: -100px; background: var(--ink); color: var(--paper); padding: 10px 14px; z-index: 10; text-decoration: none; }
.skip:focus { top: 12px; outline: 2px solid var(--paper); outline-offset: -5px; }

/* ---------- Type scale ---------- */
.eyebrow, .facts dt, .facts-col dt, .skills dt, .index {
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow { margin-bottom: .9rem; }
.eyebrow-gap { margin-top: 2rem; }
.index { color: var(--ink); font-variant-numeric: tabular-nums; }
.index span { color: var(--muted); margin-left: .6em; }
.body-lg { font-size: var(--t-l); line-height: 1.5; letter-spacing: -0.005em; max-width: 60ch; }
.h-small { font-size: var(--t-l); }

/* ---------- Layout ---------- */
.site-head, .hero, .facts, .section, .site-foot {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.site-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 18px 0;
}
.wordmark { white-space: nowrap; font-family: var(--serif); font-weight: 400; font-variation-settings: "opsz" 24; letter-spacing: -0.01em; text-decoration: none; font-size: 1.2rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 clamp(14px, 2.5vw, 32px); font-size: var(--t-s); }
.site-nav a { display: inline-block; padding: 9px 2px; text-decoration: none; color: var(--ink-2); }
.site-nav a:hover, .site-nav .nav-resume { color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
  padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 6vw, 80px);
}
.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.6rem);
  line-height: 1;
  max-width: 14ch;
  margin-bottom: clamp(24px, 3vw, 40px);
}
.lede { font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.5; max-width: 54ch; color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; margin-top: clamp(20px, 2.5vw, 36px); }
.button {
  display: inline-block; background: var(--ink); color: var(--paper);
  padding: 14px 22px; text-decoration: none; font-weight: 500; font-size: var(--t-m); letter-spacing: .005em;
  border-radius: var(--radius); transition: background .15s ease;
}
.button:hover { background: #000; }
.text-link, .meta-row a, .contact-links a { display: inline-block; padding: 10px 0; }
.text-link { font-size: var(--t-m); font-weight: 500; }

/* Portrait at native 400px in a thin plate. */
.hero-photo { margin: 0; justify-self: end; width: 100%; max-width: 400px; }
.hero-photo img { width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--rule-strong); padding: 6px; background: var(--paper); filter: saturate(.92); }
figcaption { font-family: var(--serif); font-style: italic; font-weight: 400; font-variation-settings: "opsz" 14; font-size: var(--t-s); color: var(--muted); }

/* ---------- Facts strip ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding: 36px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-m);
  line-height: 1.45;
}
.facts dt { margin-bottom: .6rem; }
.facts .muted { font-size: var(--t-s); }

/* ---------- Sections ---------- */
.section { padding-top: var(--section); }
.section-head {
  display: grid;
  grid-template-columns: 2fr 10fr;
  gap: 24px;
  align-items: start;
  padding-bottom: clamp(32px, 4vw, 56px);
}
.section-head .index { padding-top: .9em; }
.section-head h2 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); }
.section-flagship .section-head h2 { font-size: clamp(2.6rem, 5vw, 4.4rem); }
.section-sub { margin-top: 14px; font-size: var(--t-m); color: var(--ink-2); max-width: 60ch; }

.cols { display: grid; gap: clamp(32px, 5vw, 80px); padding-top: clamp(40px, 5vw, 72px); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-flagship { grid-template-columns: 5fr 7fr; }
.cols-rule { margin-top: clamp(40px, 5vw, 72px); border-top: 1px solid var(--rule); }
.cols-rule p:last-child { max-width: 62ch; }

.points li { padding: 14px 0; border-top: 1px solid var(--rule); font-size: var(--t-m); line-height: 1.5; color: var(--ink-2); }
.points li:first-child { border-top: 0; padding-top: 0; }
.points-tight li { padding: 10px 0; font-size: var(--t-s); }
.points-tight li:first-child { padding-top: 0; }

.meta-row { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: 0 24px; font-size: var(--t-s); font-weight: 500; }

/* yourCB stats row: numbers in the display face, no tiles. */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 32px;
  margin-top: clamp(40px, 5vw, 64px); padding: 28px 0 0; border-top: 1px solid var(--rule);
}
.stats li { display: flex; flex-direction: column; gap: 8px; }
.stat-n { font-family: var(--serif); font-weight: 300; font-variation-settings: "opsz" 144; font-size: clamp(2.2rem, 3.6vw, 3.2rem); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: var(--t-s); color: var(--muted); line-height: 1.4; max-width: 24ch; text-wrap: pretty; }

/* yourCB fact list beside the prose. */
.facts-col { margin-top: 2rem; border-top: 1px solid var(--rule); }
.facts-col > div { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: var(--t-s); }
.facts-col dt { padding-top: 3px; }
.facts-col dd { color: var(--ink-2); }

/* Numbered "What I built" list. */
.built { counter-reset: built; }
.built li { counter-increment: built; display: grid; grid-template-columns: 40px 1fr; gap: 0 12px; padding: 18px 0; border-top: 1px solid var(--rule); }
.built li:first-child { border-top: 0; padding-top: 0; }
.built li::before { content: "0" counter(built); font-size: var(--t-xs); font-weight: 500; letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.built h3 { grid-column: 2; font-size: var(--t-m); margin-bottom: 6px; }
.built p { grid-column: 2; font-size: var(--t-s); line-height: 1.5; color: var(--ink-2); }

/* ---------- Image bands ---------- */
.band {
  margin: 0;
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(20px, 4.5vw, 72px);
}
.band figcaption { margin-top: 18px; max-width: 70ch; }
.band-yourcb { padding-right: clamp(20px, 12vw, 180px); }

.browser-frame {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.browser-frame::before {
  content: attr(data-url);
  display: block;
  height: 30px;
  line-height: 30px;
  text-align: center;
  position: relative;
  z-index: 1;
  background: #f1f0ec;
  border-bottom: 1px solid #e3e1db;
  font-size: var(--t-xs);
  letter-spacing: .06em;
  color: var(--muted);
}
.browser-frame img { width: 100%; }
/* The kjar.in capture ends mid-section; end the frame on the heading instead. */
.band-kjar .browser-frame img { aspect-ratio: 1440 / 800; object-fit: cover; object-position: 0 0; }

.phone-frame {
  background: #0b0b0c;
  border-radius: 22px;
  padding: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.phone-frame img { border-radius: 17px; width: 100%; }
.phone-frame-overlap {
  position: absolute;
  right: clamp(16px, 4vw, 64px);
  bottom: clamp(52px, 7vw, 110px);
  width: clamp(110px, 15vw, 210px);
  padding: 5px;
  border-radius: 18px;
}
.phone-frame-overlap img { border-radius: 14px; }

/* Phone shots are cropped in the frame: Snake and Ladder carries letterbox bars,
   Block Merge carries a status bar and an ad strip. */
.phone-crop { aspect-ratio: 9 / 17; }
.phone-crop img { width: 100%; height: 100%; object-fit: cover; }
.crop-ad img { object-position: 50% 45%; }
.crop-board img { object-position: 50% 100%; }
.crop-players img { object-position: 50% 92%; }

/* ---------- Architecture diagram ---------- */
.arch { margin-top: clamp(48px, 6vw, 88px); padding-top: clamp(32px, 4vw, 48px); border-top: 1px solid var(--rule); }
.arch-head { display: grid; grid-template-columns: 2fr 10fr; gap: 24px; margin-bottom: 36px; align-items: start; }
.arch-head .eyebrow { padding-top: .55em; margin: 0; }
.pull { font-family: var(--serif); font-style: italic; font-weight: 400; font-variation-settings: "opsz" 144; font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.2; color: var(--ink); max-width: 28ch; text-wrap: balance; }
.arch-grid {
  display: grid;
  grid-template-columns: 1fr 84px 1fr 84px 1fr;
  gap: 24px 0;
  align-items: stretch;
}
.node {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--link-rule);
  border-radius: var(--radius);
  padding: 38px 18px 18px;
  min-height: 150px;
}
.node::before {
  content: attr(data-step);
  position: absolute; top: 13px; left: 18px;
  font-size: var(--t-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.node-core { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.node-quiet { background: transparent; border-style: dashed; }
.node-span { grid-column: 3 / -1; }
.node-title { font-weight: 600; font-size: var(--t-m); letter-spacing: -0.01em; margin-bottom: 6px; }
.node-sub { font-size: var(--t-s); color: var(--muted); line-height: 1.4; }
.node-list { font-size: var(--t-s); color: var(--ink-2); line-height: 1.45; }
.node-list li { padding-left: 12px; position: relative; }
.node-list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 1px; background: var(--link-rule); }
.node-list-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.pill { display: inline-block; vertical-align: 2px; margin-left: 6px; font-size: .72rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--link-rule); border-radius: 999px; padding: 1px 7px; }

.arrow { position: relative; align-self: center; height: 1px; background: var(--link-rule); margin: 0 8px; }
.arrow::after {
  content: ""; position: absolute; right: -1px; top: -4px;
  width: 7px; height: 7px; border-top: 1px solid var(--link-rule); border-right: 1px solid var(--link-rule);
  transform: rotate(45deg);
}
.arrow::before {
  content: attr(data-label);
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  white-space: nowrap; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.node-wide { grid-column: 1 / -1; min-height: 0; padding-bottom: 16px; }
.node-row { display: flex; flex-wrap: wrap; gap: 8px 40px; font-size: var(--t-s); color: var(--ink-2); }
.node-row strong { color: var(--ink); margin-right: 8px; }

/* ---------- Apps ---------- */
.app {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding: clamp(40px, 5vw, 72px) 0;
  border-top: 1px solid var(--rule);
}
.app:first-of-type { border-top: 0; padding-top: 0; }
.app-reverse { grid-template-columns: 8fr 4fr; }
.app-reverse .app-text { order: 2; }
.app-reverse .app-shots-wrap { order: 1; }
.app-text { max-width: 62ch; }
.app-text > p { color: var(--ink-2); margin-bottom: 1.2rem; }
.app-mark { display: flex; align-items: center; gap: 16px; margin-bottom: 1.4rem; }
.app-mark img { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.app-mark h3 { font-size: var(--t-xl); }
.app-meta { font-size: var(--t-s); color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status {
  display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--paper); background: var(--ink); padding: 3px 7px 2px; border-radius: var(--radius);
}
.status-quiet { color: var(--ink); background: var(--surface-2); }
.app-shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2.5vw, 28px);
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 56px) clamp(20px, 5vw, 72px);
  align-items: end;
}
.app-shots-2 { grid-template-columns: 1fr 1fr; padding-inline: clamp(40px, 9vw, 140px); }
.swipe-hint { display: none; }
.cols-rule h3 { margin-bottom: 8px; }
.cols-rule .app-meta { margin-bottom: 14px; }
.cols-rule p:last-child { color: var(--ink-2); }

/* ---------- Timeline ---------- */
.timeline li {
  display: grid;
  grid-template-columns: 2fr 10fr;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.t-date { font-size: var(--t-s); color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.timeline h3 { font-size: var(--t-l); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.t-role { font-size: var(--t-s); font-weight: 400; color: var(--muted); }
.timeline p:not(.t-date) { margin-top: 8px; color: var(--ink-2); max-width: 72ch; }
.education { display: grid; grid-template-columns: 2fr 10fr; gap: 24px; padding: 26px 0 0; }
.education .eyebrow { margin: 0; padding-top: 4px; }
.education p:last-child { color: var(--ink-2); }

/* ---------- Skills ---------- */
.skills > div {
  display: grid; grid-template-columns: 2fr 10fr; gap: 24px;
  padding: 18px 0; border-top: 1px solid var(--rule);
}
.skills > div:last-child { border-bottom: 1px solid var(--rule); }
.skills dt { padding-top: 5px; }
.skills dd { color: var(--ink-2); }

/* ---------- Contact ---------- */
.section-contact { padding-bottom: clamp(48px, 6vw, 80px); }
.contact-email { font-family: var(--serif); font-weight: 300; font-variation-settings: "opsz" 144; font-size: clamp(1.7rem, 4.6vw, 4rem); letter-spacing: -0.02em; line-height: 1.1; overflow-wrap: anywhere; }
.contact-email a { text-decoration-thickness: 1px; text-underline-offset: .14em; }
.contact-links { display: flex; flex-wrap: wrap; gap: 0 22px; margin-top: 26px; font-size: var(--t-m); font-weight: 500; }

.site-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 28px 0 40px; border-top: 1px solid var(--ink); font-size: var(--t-s);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 7fr 5fr; }
  .app { grid-template-columns: 5fr 7fr; }
  .app-reverse { grid-template-columns: 7fr 5fr; }
  .facts, .stats { grid-template-columns: repeat(2, 1fr); }
  .cols-flagship { grid-template-columns: 1fr 1fr; }
  /* keep the caption clear of the overlapping phone */
  .band-yourcb figcaption { padding-right: clamp(72px, 10vw, 110px); }
}

@media (max-width: 820px) {
  .section-head, .arch-head, .timeline li, .education, .skills > div { grid-template-columns: 1fr; gap: 10px; }
  .section-head .index { padding-top: 0; }
  .arch-head .eyebrow { padding-top: 0; }
  .cols-2, .cols-flagship { grid-template-columns: 1fr; }
  .app, .app-reverse { grid-template-columns: 1fr; }
  .app-reverse .app-text { order: 1; }
  .app-reverse .app-shots-wrap { order: 2; }
  /* Diagram stacks into two labelled columns of boxes. */
  .arch-grid { grid-template-columns: 1fr; gap: 0; }
  .node { min-height: 0; padding: 30px 16px 14px; }
  .node::before { top: 11px; left: 16px; }
  .node-span { grid-column: auto; }
  .node-list-2 { grid-template-columns: 1fr; }
  .arrow { width: 1px; height: 40px; margin: 0 auto; }
  .arrow::after { right: -3px; top: auto; bottom: 0; transform: rotate(135deg); }
  .arrow::before { top: 50%; left: 14px; transform: translateY(-50%); }
  .node-wide { margin-top: 24px; }
  .arch-grid > .node:first-child, .node-newrow { margin-top: 26px; }
  .arch-grid > .node:first-child::after, .node-newrow::after {
    position: absolute; top: -24px; left: 0;
    font-size: var(--t-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500;
  }
  .arch-grid > .node:first-child::after { content: "Request path"; }
  .node-newrow { margin-top: 44px; }
  .node-newrow::after { content: "Ingestion path"; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-head { padding: 10px 0; }
  .site-nav { gap: 0 14px; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 14px; }
  .hero-photo { order: -1; width: 50%; justify-self: start; }
  .hero-photo img { padding: 4px; }
  .hero h1 { font-size: clamp(2.4rem, 11.5vw, 3.2rem); max-width: none; }
  .facts { grid-template-columns: 1fr; gap: 22px; padding: 28px 0; }
  .stats { grid-template-columns: 1fr 1fr; gap: 24px 20px; }
  .built li { grid-template-columns: 32px 1fr; }
  .band-yourcb { padding-right: clamp(20px, 4.5vw, 72px); }
  .band-yourcb figcaption { padding-right: 0; }
  .browser-frame::before { height: 24px; line-height: 24px; font-size: .72rem; }
  /* On a phone, show the phone capture and drop the desktop one. */
  .band-yourcb .browser-frame { display: none; }
  .band-yourcb .phone-frame-overlap { display: block; position: static; width: 58%; margin: 0 auto; }
  /* Phones become a horizontally scroll-snapped row instead of three tiny thumbnails. */
  .app-shots, .app-shots-2 {
    display: flex; gap: 14px; padding: 16px 0 16px 16px; align-items: end;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 16px;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  }
  .app-shots::after { content: ""; flex: 0 0 16px; }
  .app-shots .phone-frame { flex: 0 0 min(210px, 72%); scroll-snap-align: start; }
  .swipe-hint { display: block; margin-top: 10px; font-size: var(--t-s); color: var(--muted); }
  .phone-frame { border-radius: 16px; padding: 4px; }
  .phone-frame img { border-radius: 12px; }
  .app-mark h3 { font-size: 1.3rem; }
  .meta-row { gap: 0 18px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .skip, .site-nav, .hero-cta, .band, .app-shots-wrap, .phone-frame { display: none; }
  .hero { grid-template-columns: 1fr 140px; }
  .section { padding-top: 28pt; break-inside: avoid; }
  a { text-decoration: none; color: #000; }
  .contact-links a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
