/* Aman Khandelwal, portfolio. One stylesheet, one script, no framework. */
:root {
  --bg: #111315; --surface: #1C2024; --surface-2: #24292E;
  --text: #F1F2F0; --text-2: #A1A7AD; --muted: #8A939A;
  --accent: #55D6BE; --accent-2: #F2A65A; --border: #30363B;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --wrap: 1240px; --gut: clamp(20px, 4vw, 40px); --nav: 64px;
  --r: 6px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--border); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
.mono { font-family: var(--mono); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: #0b1f1b; padding: 10px 14px; border-radius: var(--r); font-weight: 600; }
.skip:focus { top: 12px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 50; background: rgb(17 19 21 / .94); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.nav__bar { display: flex; align-items: center; justify-content: space-between; height: var(--nav); }
.nav__brand { font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.nav__menu { display: flex; align-items: center; gap: 28px; }
.nav__menu ul { display: flex; gap: 26px; list-style: none; }
.nav__menu a { text-decoration: none; font-size: 14px; color: var(--text-2); }
.nav__menu a:hover, .nav__menu a[aria-current] { color: var(--text); }
.nav__toggle { display: none; width: 44px; height: 44px; background: none; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; padding: 0; position: relative; }
.nav__toggle span { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--text); transition: transform .2s, top .2s; }
.nav__toggle span:first-child { top: 16px; } .nav__toggle span:last-child { top: 26px; }
.nav__toggle[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid var(--accent); border-radius: var(--r); background: var(--accent); color: #0b1f1b; font: 500 15px/1 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.btn:hover { background: #7be3d0; border-color: #7be3d0; color: #0b1f1b; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); border-color: var(--text-2); color: var(--text); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; background: transparent; color: var(--text); border-color: var(--border); }
.btn--sm:hover { background: var(--surface); border-color: var(--text-2); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.link { color: var(--text); font-weight: 500; text-decoration-color: var(--accent); }
.link::after { content: " \2192"; color: var(--accent); }

/* type helpers */
.eyebrow { font: 500 13px/1.4 var(--mono); letter-spacing: .02em; color: var(--accent-2); margin: 0 0 14px; }
.muted { color: var(--text-2); }
.lead { font-size: 19px; line-height: 1.6; color: var(--text-2); max-width: 62ch; }
.stack { font: 400 13px/1.6 var(--mono); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chips li { font: 400 13px/1 var(--mono); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; }
.hero .chips li:nth-child(-n+4) { border-color: rgb(242 166 90 / .45); }

/* sections */
.section { padding: clamp(64px, 9vw, 112px) 0; border-top: 1px solid var(--border); }
.section__head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section__head h2 { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 14px; }
.section__head p { color: var(--text-2); font-size: 18px; margin: 0; }
.grid { display: grid; gap: clamp(24px, 3vw, 40px); }

/* hero */
.hero { padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 8vw, 96px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.status { display: inline-flex; align-items: center; gap: 10px; font: 400 13px/1.4 var(--mono); color: var(--text-2); margin-bottom: 28px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgb(85 214 190 / .16); }
.hero h1 { font-size: clamp(36px, 5vw, 60px); letter-spacing: -.025em; margin-bottom: 8px; }
.hero__name { font: 500 17px/1.4 var(--mono); color: var(--accent-2); margin-bottom: 20px; display: block; }
.hero__say { font-size: clamp(19px, 2vw, 22px); line-height: 1.5; max-width: 34em; margin-bottom: 20px; }
.hero .lead { margin-bottom: 28px; font-size: 17px; }
.hero .chips { margin-bottom: 32px; }
.hero__links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 28px 0 0; font: 400 14px/1.6 var(--mono); }
.hero__links span { color: var(--muted); }
.hero__links a { color: var(--text-2); }
.hero__loc { margin: 18px 0 0; font: 400 13px/1.5 var(--mono); color: var(--muted); }
.mosaic { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: auto auto; gap: 12px; }
.mosaic a { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.mosaic a:first-child { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; aspect-ratio: 16 / 11; transition: transform .5s ease; }
.mosaic a:first-child img { aspect-ratio: auto; min-height: 100%; }
.mosaic a:hover img { transform: scale(1.02); }
.mosaic span { position: absolute; left: 0; bottom: 0; right: 0; padding: 22px 14px 10px; font: 400 12px/1.3 var(--mono); color: var(--text); background: linear-gradient(transparent, rgb(17 19 21 / .85)); }

.hero__side { display: flex; justify-content: center; }
.hero__photo { width: min(400px, 100%); aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: var(--r); box-shadow: 8px 8px 0 var(--accent-2); }
.hero__thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(100%, 420px); margin-top: 18px; }
.hero__thumbs a { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.hero__thumbs img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: 50% 40%; transition: transform .5s ease; }
.hero__thumbs a:hover img { transform: scale(1.03); }
.hero__thumbs span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font: 400 12px/1.3 var(--mono); background: linear-gradient(transparent, rgb(17 19 21 / .88)); }
.work__feature.work__feature--rev { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); border-top: 1px solid var(--border); padding-top: clamp(40px, 6vw, 72px); }
.more { color: var(--text-2); margin: 0; }
.stats { border-top: 1px solid var(--border); }
.stats__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.stats__row div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; padding: 28px 24px; border-right: 1px solid var(--border); }
.stats__row div:first-child { padding-left: 0; }
.stats__row div:last-child { border-right: 0; }
.stats__row dd { margin: 0; font: 600 clamp(28px, 3.2vw, 40px)/1.1 var(--font); letter-spacing: -.02em; color: var(--text); }
.stats__row dt { font: 400 13px/1.45 var(--mono); color: var(--text-2); }
/* media frame */
.frame { display: block; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.frame img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.frame--contain img { object-fit: contain; background: #0d0f10; }
.frame--natural img { aspect-ratio: auto; }
/* same treatment as the profile photo: thin border + amber offset block */
.frame, .trailer { --off: 8px; box-shadow: var(--off) var(--off) 0 var(--accent-2); margin-right: var(--off); margin-bottom: var(--off); }
.tool > .frame, .shots .frame { --off: 6px; }

/* selected work */
.work { display: grid; gap: clamp(40px, 6vw, 72px); }
.work__feature { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.work__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); border-top: 1px solid var(--border); padding-top: clamp(40px, 6vw, 72px); }
.project h3 { font-size: clamp(24px, 2.6vw, 32px); margin: 6px 0 8px; }
.project h3 a { text-decoration: none; }
.project p { color: var(--text-2); }
.project__facts { margin: 18px 0 20px; display: grid; gap: 14px; }
.project__facts div { border-left: 2px solid var(--accent); padding-left: 14px; }
.project__facts dt { font: 500 12px/1.4 var(--mono); color: var(--accent); margin-bottom: 4px; letter-spacing: .02em; }
.project__facts div:nth-child(2) { border-left-color: var(--accent-2); }
.project__facts div:nth-child(2) dt { color: var(--accent-2); }
.project__facts dd { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.55; }
.project .frame { margin-bottom: 20px; }
.project__links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }

/* engineering summary */
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r); }
.case { display: flex; flex-direction: column; color: inherit; text-decoration: none; padding: 32px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg); transition: background .15s; }
.case:nth-child(2n) { border-right: 0; }
.case:nth-last-child(-n+2) { border-bottom: 0; }
.case:hover { background: var(--surface); color: inherit; }
.case__n { display: block; font: 500 13px/1 var(--mono); color: var(--accent-2); margin-bottom: 18px; }
.case .link { font-size: 15px; margin-top: auto; }
.case h3 { font-size: 20px; margin: 4px 0 10px; }
.case p { color: var(--text-2); font-size: 15px; }
.case a.link { font-size: 15px; }

/* expertise */
.expertise { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; }
.expertise h3 { font: 500 13px/1.4 var(--mono); color: var(--accent-2); margin-bottom: 14px; letter-spacing: .02em; }
.expertise ul { list-style: none; display: grid; gap: 8px; color: var(--text-2); font-size: 16px; }
.expertise li { padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* experience */
.role { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px clamp(24px, 4vw, 56px); padding: 32px 0; border-top: 1px solid var(--border); }
.role:first-of-type { border-top: 0; padding-top: 0; }
.role__when { font: 400 13px/1.6 var(--mono); color: var(--accent-2); }
.role h3 { font-size: 22px; margin-bottom: 4px; }
.role__org { color: var(--text-2); margin-bottom: 18px; }
.role ul { padding-left: 20px; color: var(--text-2); display: grid; gap: 8px; }
.role ul b { color: var(--text); font-weight: 500; }
.role .stack { margin-top: 18px; }

/* independent */
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.tool { border: 1px solid var(--border); border-radius: var(--r); padding: 20px 20px 24px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.tool h3 { font-size: 20px; }
.tool p { color: var(--text-2); font-size: 15px; margin: 0; }
.tool dl { margin: 0; display: grid; gap: 10px; }
.tool dt { font: 500 12px/1.4 var(--mono); color: var(--accent-2); }
.tool dd { margin: 2px 0 0; color: var(--text-2); font-size: 15px; }
.tool .project__links { margin-top: auto; padding-top: 6px; }
.tool > .frame { margin-bottom: 8px; }
.tool h3 a { text-decoration: none; }

/* about, contact */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.about .section__head { margin: 0; }
.about p { color: var(--text-2); font-size: 18px; max-width: 60ch; }
.portrait { width: min(240px, 100%); aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: var(--r); }
.contact { text-align: left; }
.contact h2 { font-size: clamp(32px, 4.6vw, 52px); margin-bottom: 16px; }
.contact__links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 32px 0 0; font: 400 15px/1.6 var(--mono); }
.contact__note { margin: 20px 0 0; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-2); font-size: 14px; }
.footer__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer__note { margin-top: 10px; color: var(--muted); font-size: 13px; }

/* project + engineering pages */
.page-head { padding: clamp(40px, 6vw, 72px) 0 clamp(32px, 4vw, 48px); }
.crumb { font: 400 13px/1.4 var(--mono); color: var(--muted); margin-bottom: 24px; }
.crumb a { color: var(--text-2); }
.page-head h1 { font-size: clamp(34px, 4.6vw, 54px); letter-spacing: -.025em; margin-bottom: 18px; }
.page-head .lead { margin-bottom: 28px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; margin: 32px 0 0; border: 1px solid var(--border); border-radius: var(--r); }
.meta div { padding: 14px 18px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: -1px -1px 0 0; }
.meta dt { font: 500 12px/1.4 var(--mono); color: var(--muted); }
.meta dd { margin: 4px 0 0; font-size: 15px; }
.meta--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 clamp(24px, 4vw, 64px); }
.doc__side { position: sticky; top: calc(var(--nav) + 24px); align-self: start; font: 400 13px/1.5 var(--mono); }
.doc__side ol { list-style: none; display: grid; gap: 10px; }
.doc__side a { color: var(--muted); text-decoration: none; }
.doc__side a:hover { color: var(--accent); }
.doc__body h2::before { content: ""; display: block; width: 28px; height: 3px; background: var(--accent-2); margin-bottom: 14px; }
.doc__body { min-width: 0; max-width: 820px; }
.doc__body section { padding: 0 0 clamp(36px, 5vw, 56px); margin-bottom: clamp(36px, 5vw, 56px); border-bottom: 1px solid var(--border); }
.doc__body section:last-child { border-bottom: 0; margin-bottom: 0; }
.doc__body h2 { font-size: clamp(24px, 2.8vw, 30px); margin-bottom: 18px; }
.doc__body h3 { font-size: 18px; margin: 28px 0 10px; }
.doc__body p, .doc__body li { color: var(--text-2); }
.doc__body ul, .doc__body ol.list { padding-left: 22px; display: grid; gap: 10px; margin-bottom: 1em; }
.doc__body li b, .doc__body p b { color: var(--text); font-weight: 500; }
.doc__body .frame, .doc__body .diagram, .doc__body .code, .doc__body .trailer { margin: 24px 0; }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 24px 0; }
.shots .frame { margin: 0; }
.shot { margin: 24px 0; }
.shots .shot { margin: 0; }
.shot figcaption { margin-top: 14px; font-size: 14px; color: var(--text-2); }
.doc__body .shot .frame { margin: 0; }
.case-study { padding: clamp(56px, 8vw, 88px) 0; border-top: 1px solid var(--border); }
.case-study > .wrap > h2 { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table th { font: 500 12px/1.4 var(--mono); color: var(--accent-2); }
.table td { color: var(--text-2); }
.code { padding: 20px; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); font: 400 13px/1.65 var(--mono); color: var(--text); }
.code .c { color: var(--muted); }
.diagram { border: 1px solid var(--border); border-radius: var(--r); padding: 22px; background: var(--surface); }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: 14px; font-size: 14px; color: var(--text-2); }
.diagram .lane { fill: var(--muted); font: 500 11px var(--mono); letter-spacing: .1em; }
.diagram .box rect { fill: var(--bg); stroke: var(--border); }
.diagram .box.hot rect { stroke: var(--accent-2); }
.diagram .t { fill: var(--text); font: 500 14px var(--font); }
.diagram .s { fill: var(--muted); font: 400 12px var(--mono); }
.diagram .arrow { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.diagram .arrow.hot { stroke: var(--accent-2); }
.diagram-scroll { overflow-x: auto; }
.diagram-scroll svg { min-width: 680px; }
.trailer { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.trailer img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.trailer__play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; translate: -50% -50%; border-radius: 50%; background: var(--accent); }
.trailer__play::after { content: ""; position: absolute; left: 26px; top: 20px; border-left: 20px solid #0b1f1b; border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.trailer__label { position: absolute; left: 12px; bottom: 10px; font: 400 12px/1.3 var(--mono); color: var(--text); background: rgb(17 19 21 / .8); padding: 4px 8px; border-radius: 4px; }
.next { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 32px; border-top: 1px solid var(--border); margin-top: 24px; }

/* motion: calm, opt-out */
.js .reveal { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* tablet */
@media (max-width: 1023px) {
  .work__feature, .work__feature.work__feature--rev, .about { grid-template-columns: 1fr; }
  .work__feature--rev > :first-child { order: 2; }
  .expertise { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc { grid-template-columns: 1fr; }
  .doc__side { display: none; }
}
/* phone */
@media (max-width: 780px) {
  .nav__toggle { display: block; }
  .nav__menu { position: fixed; inset: var(--nav) 0 auto 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px var(--gut) 20px; display: none; max-height: calc(100vh - var(--nav)); overflow-y: auto; }
  .nav__menu.is-open { display: flex; }
  .nav__menu ul { flex-direction: column; gap: 0; }
  .nav__menu li a { display: block; padding: 14px 0; font-size: 17px; border-bottom: 1px solid var(--border); }
  .nav__menu .btn { margin-top: 16px; }
  .meta--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work__pair, .tools, .cases, .shots { grid-template-columns: 1fr; }
  .case { border-right: 0; }
  .case:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .case:last-child { border-bottom: 0; }
  .expertise { grid-template-columns: 1fr; gap: 32px; }
  .role { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; }
  .stats__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats__row div { border-bottom: 1px solid var(--border); }
  .stats__row div:nth-child(2n) { border-right: 0; }
  .stats__row div:nth-child(odd) { padding-left: 0; }
  .stats__row div:nth-last-child(-n+2) { border-bottom: 0; }
  .hero__side { justify-content: flex-start; }
  .hero__photo { width: min(320px, 88%); }
  .frame, .trailer { --off: 6px; }
  .hero__photo { box-shadow: 6px 6px 0 var(--accent-2); }
  .btn-row .btn { flex: 1 1 100%; }
  .code { font-size: 12px; }
  .lead { font-size: 17px; }
  .footer__bar { flex-direction: column; }
}
