/* =====================================================================
   Gunjan Kumar Mehta — site styles
   One stylesheet for the home page, case studies and essays.
   ===================================================================== */

:root {
  --bg: #FBFBF9;
  --surface: #FFFFFF;
  --surface-2: #F3F3EF;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --border: #E5E5E0;
  --border-strong: #D4D4CE;
  --accent: #1E40AF;
  --accent-hover: #1E3A8A;
  --accent-soft: #EEF2FF;
  --ok: #047857;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 6px -2px rgba(15, 23, 42, .05), 0 12px 24px -6px rgba(15, 23, 42, .08);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --wrap: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
}
strong { color: var(--text); font-weight: 600; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: 46rem; margin: 0 auto; padding: 0 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 200; background: var(--text); color: #fff;
  padding: .5rem .9rem; border-radius: var(--radius-sm); font-size: .875rem; transition: top .2s;
}
.skip:focus { top: 1rem; color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; height: 4rem; }
.wordmark { font-family: var(--font-display); font-weight: 650; font-size: 1.02rem; color: var(--text); letter-spacing: -0.01em; }
.wordmark:hover { color: var(--text); }
.wordmark span { color: var(--muted); font-weight: 500; }
@media (max-width: 560px) { .wordmark span { display: none; } }
.nav { display: flex; align-items: center; gap: 2rem; }
.nav ul { display: flex; gap: 1.75rem; list-style: none; }
.nav ul a { font-size: .9rem; color: var(--text-2); font-weight: 500; transition: color .15s; }
.nav ul a:hover, .nav ul a[aria-current="true"] { color: var(--text); }
.nav ul a[aria-current="true"] { box-shadow: 0 2px 0 var(--accent); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  width: 2.5rem; height: 2.5rem; cursor: pointer; color: var(--text); align-items: center; justify-content: center;
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav { position: absolute; top: 4rem; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
         background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem 1.5rem 1.25rem; box-shadow: var(--shadow-md); display: none; }
  .nav.open { display: flex; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav ul a { display: block; padding: .75rem 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
  .nav ul a[aria-current="true"] { box-shadow: none; color: var(--accent); }
  .nav .btn { margin-top: 1rem; justify-content: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: .6rem 1.15rem;
  font: 500 .925rem/1 var(--font-sans); border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s var(--ease);
}
.btn:hover { border-color: var(--text); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn-primary:hover { background: #1E293B; border-color: #1E293B; color: #fff; }
.btn-sm { min-height: 2.25rem; padding: .45rem .9rem; font-size: .85rem; }
.btn svg { width: 1em; height: 1em; flex: none; }

/* ---------- Sections ---------- */
section { padding: 6rem 0; scroll-margin-top: 4rem; }
section + section { border-top: 1px solid var(--border); }
.section-head { display: grid; grid-template-columns: 18rem 1fr; gap: 3rem; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
.section-head p { font-size: 1.075rem; color: var(--text-2); max-width: 42rem; }
.kicker { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .75rem; }
@media (max-width: 860px) {
  section { padding: 4.5rem 0; }
  .section-head { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 2.25rem; }
}

/* ---------- Hero ---------- */
.hero { padding: 5.5rem 0 5rem; border-top: none; }
.hero-grid { display: grid; grid-template-columns: 1fr 20rem; gap: 4rem; align-items: center; }
.availability {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 500; color: var(--ok);
  background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: 99px; padding: .3rem .8rem; margin-bottom: 1.75rem;
}
.availability i { width: .45rem; height: .45rem; border-radius: 99px; background: var(--ok); box-shadow: 0 0 0 3px #D1FAE5; }
.hero h1 { font-size: clamp(2.35rem, 5vw, 3.6rem); letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 1.5rem; max-width: 20ch; }
.hero h1 em { font-style: normal; color: var(--muted); }
.hero .lede { font-size: clamp(1.075rem, 1.6vw, 1.2rem); color: var(--text-2); max-width: 38rem; margin-bottom: 2.25rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem; box-shadow: var(--shadow-md); }
.portrait { width: 7.5rem; height: 7.5rem; border-radius: 99px; overflow: hidden; margin-bottom: 1.25rem; background: var(--surface-2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); }
.profile-card h2 { font-size: 1.2rem; letter-spacing: -0.01em; }
.profile-card .role { color: var(--muted); font-size: .925rem; margin-bottom: 1.25rem; }
.facts { list-style: none; border-top: 1px solid var(--border); }
.facts li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.facts li span:first-child { color: var(--muted); }
.facts li span:last-child { color: var(--text); font-weight: 500; text-align: right; }
@media (max-width: 960px) {
  .hero { padding: 3.5rem 0 4rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
  .profile-card { max-width: 26rem; }
}

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.metric { padding: 1.75rem 1.5rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.metric:nth-child(4n) { border-right: none; }
.metric:nth-last-child(-n+4) { border-bottom: none; }
.metric .num { font-family: var(--font-display); font-size: 2.25rem; font-weight: 650; color: var(--text); letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .lbl { font-size: .9rem; color: var(--muted); margin-top: .35rem; }
@media (max-width: 860px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(4n) { border-right: 1px solid var(--border); }
  .metric:nth-child(2n) { border-right: none; }
  .metric:nth-last-child(-n+4) { border-bottom: 1px solid var(--border); }
  .metric:nth-last-child(-n+2) { border-bottom: none; }
}

/* ---------- Pillars ---------- */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.pillar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.pillar .ico { width: 2.5rem; height: 2.5rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 1.25rem; }
.pillar .ico svg { width: 1.25rem; height: 1.25rem; }
.pillar h3 { font-size: 1.15rem; margin-bottom: .6rem; }
.pillar p { font-size: .95rem; margin-bottom: 1rem; }
.pillar ul { list-style: none; font-size: .9rem; }
.pillar li { padding: .45rem 0 .45rem 1.25rem; position: relative; border-top: 1px solid var(--border); }
.pillar li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: .45rem; height: 1px; background: var(--muted); }
@media (max-width: 960px) { .pillars { grid-template-columns: 1fr; } }

/* ---------- Experience ---------- */
.roles { display: grid; gap: 0; }
.role-item { display: grid; grid-template-columns: 18rem 1fr; gap: 3rem; padding: 2.25rem 0; border-top: 1px solid var(--border); }
.role-item:first-child { border-top: none; padding-top: 0; }
.role-meta .dates { font-size: .9rem; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.role-meta .place { font-size: .875rem; color: var(--muted); }
.role-body h3 { font-size: 1.25rem; margin-bottom: .2rem; }
.role-body .org { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
.role-body .org a { color: var(--text-2); font-weight: 500; }
.role-body > p { margin-bottom: 1rem; }
.role-body ul { list-style: none; display: grid; gap: .5rem; }
.role-body li { padding-left: 1.25rem; position: relative; }
.role-body li::before { content: ""; position: absolute; left: 0; top: .72rem; width: .4rem; height: .4rem; border-radius: 99px; background: var(--border-strong); }
.engagements { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1.25rem; }
.engagement { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 1rem 1.1rem; font-size: .9rem; }
.engagement b { display: block; color: var(--text); font-weight: 600; font-size: .95rem; }
.engagement span { color: var(--muted); font-size: .825rem; display: block; margin-bottom: .35rem; }
.edu { margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: grid; grid-template-columns: 18rem 1fr; gap: 3rem; font-size: .95rem; }
.edu .k { color: var(--muted); }
@media (max-width: 860px) {
  .role-item, .edu { grid-template-columns: 1fr; gap: .75rem; }
  .engagements { grid-template-columns: 1fr; }
}

/* ---------- Case studies ---------- */
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.case {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; color: var(--text-2); transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.case:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--text-2); }
.case .tag { font-size: .775rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 1.5rem; }
.case .big { font-family: var(--font-display); font-size: 2.5rem; font-weight: 650; color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.case .big-lbl { font-size: .85rem; color: var(--muted); margin: .4rem 0 1.5rem; }
.case h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.case p { font-size: .925rem; flex: 1; }
.read { margin-top: 1.25rem; font-size: .9rem; font-weight: 500; color: var(--accent); display: inline-flex; align-items: center; gap: .35rem; }
.case:hover .read, .post:hover .read { gap: .6rem; }
.read { transition: gap .2s var(--ease); }
@media (max-width: 960px) { .cases { grid-template-columns: 1fr; } }

/* ---------- Principles ---------- */
.principles { list-style: none; counter-reset: p; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.principle { counter-increment: p; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; display: flex; flex-direction: column; }
.principle h3 { font-size: 1.15rem; margin-bottom: .6rem; display: flex; gap: .75rem; align-items: baseline; }
.principle h3::before { content: counter(p, decimal-leading-zero); font-size: .8rem; font-weight: 600; color: var(--accent); font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.principle > p { font-size: .95rem; margin-bottom: 1rem; }
.principle .practice { margin: auto 0 0; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .9rem; color: var(--text-2); }
.principle .practice b { display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .3rem; }
.principle-quote { background: var(--text); border-color: var(--text); justify-content: center; counter-increment: none; }
.principle-quote .quote { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.3; letter-spacing: -0.02em; color: #fff; font-weight: 600; margin-bottom: .9rem; }
.principle-quote .quote-by { font-size: .875rem; color: #94A3B8; margin: 0; }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; } }

/* ---------- Approach ---------- */
.approach { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.panel h3 { font-size: 1.05rem; margin-bottom: 1.1rem; }
.steps { list-style: none; counter-reset: s; display: grid; gap: 1rem; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2rem 1fr; gap: .75rem; font-size: .95rem; }
.steps li::before { content: counter(s, decimal-leading-zero); font-size: .8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15rem; }
.steps b { color: var(--text); font-weight: 600; display: block; }
.kv { list-style: none; font-size: .925rem; }
.kv li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.kv li:first-child { border-top: none; padding-top: 0; }
.kv li span:first-child { color: var(--text); font-weight: 500; }
.panel + .panel { margin-top: 1.25rem; }
.decision { font-size: .925rem; }
.decision p { margin-bottom: .6rem; }
.decision .q { color: var(--text); font-weight: 500; }
.decision .a { padding-left: 1rem; border-left: 2px solid var(--border); }
.decision .rule { margin-top: 1rem; padding: .75rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .875rem; color: var(--text); }
@media (max-width: 960px) { .approach { grid-template-columns: 1fr; } .kv li { grid-template-columns: 1fr; gap: .15rem; } }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.25rem 3rem; }
.skills h3 { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .9rem; font-family: var(--font-sans); }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; }
.tags li { font-size: .875rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .3rem .65rem; }
@media (max-width: 860px) { .skills { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .skills { grid-template-columns: 1fr; } }

/* ---------- Writing ---------- */
.posts { list-style: none; border-top: 1px solid var(--border); }
.post { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--border); color: var(--text-2); }
.post:hover { color: var(--text-2); }
.post h3 { font-size: 1.15rem; margin-bottom: .3rem; transition: color .15s; }
.post:hover h3 { color: var(--accent); }
.post p { font-size: .95rem; color: var(--muted); }
.post .read { margin-top: 0; white-space: nowrap; }
@media (max-width: 640px) { .post { grid-template-columns: 1fr; gap: .5rem; } }

/* ---------- Contact ---------- */
.contact { background: var(--text); color: #CBD5E1; border-top: none; }
.contact + footer { border-top-color: #1E293B; }
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 4rem; align-items: start; }
.contact h2 { color: #fff; font-size: clamp(2rem, 4vw, 2.85rem); letter-spacing: -0.03em; margin-bottom: 1.25rem; }
.contact .kicker { color: #93C5FD; }
.contact p { font-size: 1.1rem; max-width: 34rem; margin-bottom: 2rem; }
.contact .btn { background: transparent; color: #fff; border-color: #475569; }
.contact .btn:hover { border-color: #fff; }
.contact .btn-primary { background: #fff; color: var(--text); border-color: #fff; }
.contact .btn-primary:hover { background: #E2E8F0; border-color: #E2E8F0; color: var(--text); }
.contact-list { list-style: none; border-top: 1px solid #334155; }
.contact-list li { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid #334155; font-size: .95rem; }
.contact-list span { color: #94A3B8; }
.contact-list a, .contact-list b { color: #fff; font-weight: 500; word-break: break-word; }
.contact-list a:hover { color: #BFDBFE; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; } }

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0; font-size: .875rem; color: var(--muted); border-top: 1px solid var(--border); }
.home .site-footer { background: var(--text); color: #94A3B8; border-top-color: #1E293B; }
.home .site-footer a { color: #CBD5E1; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-inner nav { display: flex; gap: 1.5rem; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Reveal (progressive enhancement) ---------- */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* =====================================================================
   Article pages (case studies + essays)
   ===================================================================== */
.article { padding: 4.5rem 0 5rem; border-top: none; }
.crumbs { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.article .eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.article h1 { font-size: clamp(2rem, 4.5vw, 2.85rem); letter-spacing: -0.03em; margin: .85rem 0 1rem; }
.article .grad-text { color: inherit; }
.article .meta { font-size: .9rem; color: var(--muted); padding-bottom: 2rem; margin-bottom: 2.25rem; border-bottom: 1px solid var(--border); }
.article h2 { font-size: 1.45rem; margin: 2.75rem 0 .9rem; }
.article h3 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
.article p { font-size: 1.075rem; line-height: 1.75; margin-bottom: 1.25rem; color: var(--text-2); }
.article ul, .article ol { margin: 0 0 1.25rem 1.25rem; color: var(--text-2); font-size: 1.05rem; }
.article li { margin-bottom: .5rem; }
.article blockquote { border-left: 3px solid var(--accent); padding: .35rem 0 .35rem 1.25rem; margin: 2rem 0; color: var(--text); font-size: 1.175rem; font-weight: 500; line-height: 1.55; }
.article .case-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 2.25rem 0; overflow: hidden; }
.article .stat { padding: 1.1rem 1.2rem; border-right: 1px solid var(--border); }
.article .stat:last-child { border-right: none; }
.article .stat .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 650; color: var(--text); letter-spacing: -0.02em; }
.article .stat .lbl { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
@media (max-width: 560px) { .article .stat { border-right: none; border-bottom: 1px solid var(--border); } .article .stat:last-child { border-bottom: none; } }
.article .diagram-wrap { margin: 2.5rem 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--surface); overflow-x: auto; }
.article .diagram-wrap svg { width: 100%; min-width: 34rem; height: auto; display: block; }
.article .cap { font-size: .825rem; color: var(--muted); margin: .75rem 0 0; text-align: center; }
.article-end { margin-top: 3.5rem; padding: 1.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between; }
.article-end p { margin: 0; font-size: 1rem; color: var(--text); font-weight: 500; }
.article-end .cta-row { gap: .5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .nav-toggle, .cta-row, .article-end { display: none !important; }
  body { background: #fff; }
  section { padding: 2rem 0; }
  .contact { background: #fff; color: var(--text-2); }
  .contact h2, .contact-list a, .contact-list b { color: var(--text); }
}
