/* iamshubhamraj.com: shared styles. Concept: noise in, signal out. */

:root {
  --paper: #F3F5F8;
  --paper-2: #E6EAF0;
  --ink: #0C1A2E;
  --ink-2: #4A5870;
  --rule: #C9D1DD;
  --cobalt: #2F4BFF;
  --cobalt-deep: #1E33C4;
  --coral: #FF5C7A;
  --sun: #FFC83D;
  --mint: #2FBF8F;
  --on-bright: #0C1A2E;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0C1A2E;
    --paper-2: #13253F;
    --ink: #EEF2F8;
    --ink-2: #9FAEC4;
    --rule: #263A57;
    --cobalt: #5C73FF;
    --cobalt-deep: #2F4BFF;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--display); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 4px; }
.band-cobalt :focus-visible, .band-ink :focus-visible { outline-color: var(--sun); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 50;
  background: var(--sun); color: var(--on-bright); padding: 8px 14px; border-radius: 8px; font-weight: 500;
}
.skip:focus { left: 8px; }

/* Header */
.site-head { position: relative; z-index: 10; }
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-top: 22px; padding-bottom: 22px;
}
.mark {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.03em;
  text-decoration: none;
}
.nav { display: flex; gap: clamp(14px, 3vw, 32px); font-weight: 500; font-size: 1rem; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--ink); }
.nav a[aria-current="page"] { border-bottom-color: var(--cobalt); }
.band-cobalt .nav a[aria-current="page"], .band-cobalt .nav a:hover { border-bottom-color: var(--sun); }
.band-cobalt .mark { background: var(--paper); color: var(--cobalt); }
@media (prefers-color-scheme: dark) { .band-cobalt .mark { background: #fff; } }

/* Bands */
.band-cobalt { background: #2F4BFF; color: #fff; }
.band-ink { background: var(--ink); color: var(--paper); }
.band-sun { background: var(--sun); color: var(--on-bright); }
.band-coral { background: var(--coral); color: var(--on-bright); }
.band-mint { background: var(--mint); color: var(--on-bright); }
.band-paper2 { background: var(--paper-2); }

/* Type scale */
.mega {
  font-weight: 800;
  font-size: clamp(3.6rem, 13.5vw, 12.5rem);
  line-height: 0.86;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96;
}
.h1 {
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 6.25rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 96;
}
.h2 {
  font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.h3 {
  font-weight: 700;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.lede { font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.45; max-width: 38ch; }
.muted { color: var(--ink-2); }
.band-cobalt .muted { color: rgba(255,255,255,0.78); }
.band-ink .muted { color: #A9B6C9; }
.prose { max-width: 64ch; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 18px; }
.prose ul { padding-left: 1.2em; margin: 0; }
.prose li + li { margin-top: 8px; }
.prose h3 { margin: 40px 0 12px; }
code, .code { font-family: var(--mono); font-size: 0.88em; }
.prose code { background: var(--paper-2); padding: 2px 6px; border-radius: 6px; }

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font: inherit; font-weight: 500; font-size: 1.0625rem;
  text-decoration: none; cursor: pointer; border: 2px solid transparent;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--cobalt); color: #fff; }
.btn-sun { background: var(--sun); color: var(--on-bright); }
.btn-sun:hover { background: #fff; }
.btn-line { border-color: currentColor; background: transparent; color: inherit; }
.btn-line:hover { background: rgba(127,127,127,0.12); }
.btn[disabled] { opacity: .5; cursor: default; }
.text-link {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px;
  text-decoration-color: var(--cobalt); font-weight: 500;
}
.band-cobalt .text-link, .band-ink .text-link { text-decoration-color: var(--sun); }
.text-link:hover { text-decoration-color: currentColor; }
.actions { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }

/* Section rhythm */
.section { padding: clamp(64px, 10vw, 128px) 0; }
.section-tight { padding: clamp(48px, 7vw, 88px) 0; }
.split {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px); align-items: start;
}
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }

/* Home hero */
.hero { padding: clamp(24px, 4vw, 48px) 0 clamp(56px, 8vw, 96px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px); align-items: end; margin-top: clamp(28px, 4vw, 48px);
}
.hero .mega { margin-top: clamp(24px, 5vw, 64px); }
.hero .lede { margin-top: 0; }
.hero .actions { margin-top: 32px; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

/* Denoise canvas */
.denoise { margin: 0; position: relative; }
.denoise canvas {
  width: 100%; aspect-ratio: 1; border-radius: 28px;
  background: var(--paper-2); touch-action: none; cursor: crosshair;
}
.denoise figcaption {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px;
  margin-top: 14px; font-size: 0.9375rem;
}
.denoise .hint { opacity: .82; }
.band-cobalt .denoise canvas { background: rgba(255,255,255,0.12); }

/* Meter under canvas */
.meter { height: 6px; border-radius: 99px; background: rgba(127,127,127,.25); overflow: hidden; margin-top: 12px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--sun); transition: width .2s linear; }

/* Chapters (the thread) */
.chapters { display: grid; gap: 0; margin-top: clamp(40px, 6vw, 72px); }
.chapter {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 420px);
  gap: clamp(20px, 4vw, 56px); align-items: center;
  padding: clamp(28px, 4vw, 44px) 0; border-top: 2px solid var(--ink);
}
.chapter:last-child { border-bottom: 2px solid var(--ink); }
.chapter .yr { font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; }
.chapter .h3 { margin-bottom: 10px; }
.chapter canvas { width: 100%; height: 150px; border-radius: 18px; }
@media (max-width: 960px) {
  .chapter { grid-template-columns: 1fr; gap: 14px; }
  .chapter canvas { height: 130px; }
}

/* Work list (big bands) */
.work-list { display: grid; gap: 16px; }
.work-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
  padding: clamp(28px, 4.5vw, 56px); border-radius: 32px; text-decoration: none;
  min-height: clamp(240px, 26vw, 340px);
  transition: transform .2s ease;
}
.work-item:hover { transform: translateY(-4px); }
@media (prefers-reduced-motion: reduce) { .work-item, .work-item:hover { transition: none; transform: none; } }
.work-item .h2 { max-width: 16ch; }
.work-item .what { margin-top: 16px; max-width: 46ch; font-size: 1.0625rem; }
.work-item .stat { text-align: right; }
.work-item .stat b {
  display: block; font-family: var(--display); font-weight: 800;
  font-size: clamp(2.6rem, 6vw, 4.75rem); line-height: .9; letter-spacing: -0.04em;
}
.work-item .stat span { font-size: 0.9375rem; }
.work-item .go { margin-top: 24px; font-weight: 500; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (max-width: 720px) {
  .work-item { grid-template-columns: 1fr; border-radius: 24px; }
  .work-item .stat { text-align: left; }
}

/* Case study */
.cs-head { padding: clamp(24px, 4vw, 48px) 0 clamp(56px, 8vw, 104px); }
.cs-head .h1 { margin-top: clamp(28px, 5vw, 64px); max-width: 15ch; }
.cs-head .lede { margin-top: 28px; max-width: 46ch; }
.facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
  margin: clamp(40px, 6vw, 72px) 0 0; padding-top: 24px; border-top: 2px solid currentColor;
}
.facts dt { font-size: 0.9375rem; opacity: .8; }
.facts dd { margin: 4px 0 0; font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.01em; }
@media (max-width: 760px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.figure { margin: 0; }
.figure .frame {
  border-radius: 28px; background: var(--paper-2); padding: clamp(16px, 3vw, 36px); overflow: hidden;
}
.figure figcaption { margin-top: 12px; font-size: 0.9375rem; color: var(--ink-2); max-width: 70ch; }
.diagram { width: 100%; height: auto; }
.diagram text { font-family: var(--body); fill: var(--ink); }
.diagram .mono { font-family: var(--mono); }

.next {
  display: block; text-decoration: none; padding: clamp(40px, 6vw, 72px) 0;
}
.next .muted { font-size: 1rem; }
.next .h1 { margin-top: 8px; transition: color .15s ease; }
.next:hover .h1 { color: var(--cobalt); }

/* Optimizer demo */
.opt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 820px) { .opt { grid-template-columns: 1fr; } }
.opt-card { background: var(--paper); border-radius: 20px; padding: 22px; border: 2px solid var(--ink); }
.opt-card h3 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 12px; font-family: var(--display); letter-spacing: -0.01em; }
.doc { font-size: 0.9375rem; line-height: 1.5; }
.doc .row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.doc .row:last-child { border-bottom: 0; }
.doc .hit { background: var(--sun); color: var(--on-bright); border-radius: 4px; padding: 0 4px; }
.doc .miss { background: var(--coral); color: var(--on-bright); border-radius: 4px; padding: 0 4px; }
.instr { font-family: var(--mono); font-size: 0.875rem; line-height: 1.55; min-height: 7.5em; white-space: pre-wrap; }
.opt-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.opt-steps li {
  padding: 6px 12px; border-radius: 99px; font-size: 0.875rem; border: 1.5px solid var(--rule); color: var(--ink-2);
}
.opt-steps li.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.opt-out { margin-top: 14px; font-weight: 500; min-height: 1.6em; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.chips li, .chip {
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--ink); font-size: 1rem; font-weight: 500;
}
button.chip { background: transparent; color: inherit; font: inherit; cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Timeline (about/resume) */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px solid var(--rule); }
.tl li:first-child { border-top: 0; padding-top: 0; }
.tl .when { color: var(--ink-2); font-variant-numeric: tabular-nums; padding-top: 3px; font-size: 1rem; }
.tl .role { font-family: var(--display); font-weight: 700; font-size: 1.375rem; line-height: 1.2; letter-spacing: -0.015em; }
.tl .org { color: var(--ink-2); margin-top: 2px; }
.tl ul { margin: 12px 0 0; padding-left: 1.1em; }
.tl ul li { display: list-item; padding: 0; border: 0; margin-top: 6px; }
@media (max-width: 600px) { .tl li { grid-template-columns: 1fr; gap: 6px; } }

/* Contact band */
.contact .mega { font-size: clamp(3.2rem, 11vw, 9.5rem); }
.contact .actions { margin-top: 36px; }

/* Empty state */
.empty {
  border: 2px dashed var(--rule); border-radius: 28px; padding: clamp(28px, 5vw, 56px);
}

/* Footer */
.site-foot { padding: 36px 0 48px; font-size: 0.9375rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .nav { gap: 14px; font-size: 0.9375rem; }
  .mark { width: 40px; height: 40px; }
  body { font-size: 1.0625rem; }
}

/* Print (resume) */
@media print {
  .site-head, .site-foot, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
}

/* Diagram */
.diagram .box { fill: var(--paper-2); stroke: var(--ink); stroke-width: 2; }
.diagram .box-hot { fill: var(--sun); }
.diagram .wire { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.diagram .arrow { fill: var(--ink-2); }
.diagram .soft { fill: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  .diagram .box-hot { fill: #FFC83D; }
}

/* Resume print header */
.print-only { display: none; }
@media print {
  .print-only { display: block; margin-bottom: 18pt; }
  .print-only p { color: #333; margin-top: 4pt; }
  .resume { padding: 0 !important; }
  .resume .wrap { padding: 0; max-width: none; }
  .resume .split { grid-template-columns: 110pt 1fr; gap: 16pt; margin-top: 14pt !important; }
  .resume .h3 { font-size: 13pt; }
  .tl li { grid-template-columns: 105pt 1fr; padding: 8pt 0; gap: 10pt; break-inside: avoid; }
  .tl .role { font-size: 12pt; }
  .tl .when, .tl .org, .muted { color: #444 !important; font-size: 10pt; }
  .tl ul { margin-top: 3pt; }
  .chips li { border-width: 1px; padding: 2pt 8pt; font-size: 9.5pt; }
  .chips { gap: 5pt; }
  @page { size: A4; margin: 16mm 16mm; }
}
@media print {
  body { font-size: 10pt; line-height: 1.4; }
  .resume .split { display: block; margin-top: 12pt !important; }
  .resume .split > h2 { margin-bottom: 6pt; border-bottom: 1.5pt solid #000; padding-bottom: 3pt; }
  .tl li { grid-template-columns: 92pt 1fr; padding: 6pt 0; }
  .tl li:first-child { padding-top: 6pt; }
  .tl .when { font-size: 9pt; }
  .tl .role { font-size: 11pt; }
  .tl ul li { margin-top: 2pt; }
  .print-only { margin-bottom: 8pt; }
  .print-only .h2 { font-size: 22pt; }
}
@media print { .resume .split .role { font-size: 11pt !important; } }
