/* aak.dev */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  --bg: #000000;
  --tile: #161617;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --accent: #2997ff;

  /* The page margin. On very wide screens it grows, so the content never runs past about 1760px. */
  --m: max(clamp(18px, 3.4vw, 52px), calc((100vw - 1760px) / 2));
  --gap: clamp(16px, 2vw, 32px);
  --pad: clamp(72px, min(10.5vw, 18svh), 160px);

  --step-small: 0.875rem;
  --step-body: 1.0625rem;
  --step-lead: clamp(1.25rem, 1.05rem + 0.9vw, 1.75rem);
  --step-head: clamp(2rem, 1.4rem + 2.9vw, 3.5rem);
  --step-poster: clamp(2.25rem, min(4.5vw, 9svh), 4.75rem);
  /* The headline is as wide as the screen allows and never taller than the screen can hold. */
  --step-display: min(clamp(3.75rem, 14.5vw, 15rem), 30svh);

  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); color-scheme: dark; overflow-x: clip; }
body {
  margin: 0; overflow-x: clip;
  background: var(--bg); color: var(--ink);
  font-family: "Inter", -apple-system, system-ui, sans-serif;
  font-size: var(--step-body); line-height: 1.47; letter-spacing: -0.01em;
  font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .9s var(--ease);            /* the ground shifts between sections instead of cutting */
}
img, canvas { max-width: 100%; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
::selection { background: #0071e3; color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h2, h3 { font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 28px; border-radius: 999px;
  background: #0071e3; color: #fff; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), background-color .2s;
}
.btn:hover { background: #1482f5; }
.btn:active { transform: scale(.96); }

.go { display: inline-block; padding: 12px 0; color: var(--accent); text-decoration: none; }
.go span { display: inline-block; transition: transform .3s var(--ease); }
.go:hover { text-decoration: underline; text-underline-offset: 4px; }
.go:hover span { transform: translateX(4px); }

/* ---------- the bar: there at the top, away while reading down, back on the way up ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 12px var(--m);
  transition: transform .5s var(--ease), background-color .9s var(--ease);
}
.top.solid { background: var(--bg); }
.top.away { transform: translateY(-101%); }
.mark { font-weight: 600; text-decoration: none; letter-spacing: -0.02em; padding: 10px 0; }
.top nav { display: flex; gap: clamp(12px, 2.2vw, 34px); }
.top nav a { text-decoration: none; padding: 10px 0; transition: color .2s; }
.top nav a:hover, .mark:hover { color: var(--accent); }

/* ---------- first screen ---------- */
.hero {
  position: relative; min-height: max(100svh, 560px);
  display: flex; flex-direction: column;
  padding: 62px var(--m) 30px;
}
h1 {
  position: relative;
  margin: clamp(16px, 5svh, 64px) 0 0;
  font-size: var(--step-display); font-weight: 700; letter-spacing: -0.04em; line-height: .9;
}
h1 .line { display: block; overflow: hidden; padding: .05em .05em .07em; margin: 0 -.05em; will-change: transform; }
h1 .line + .line { text-align: right; }
h1 .line-in { display: inline-block; }
html.js h1 .line-in { animation: rise .95s var(--ease) both; }
html.js h1 .line + .line .line-in { animation-delay: .11s; }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }

/* "Karachi" is a button: it raises the flag over the map */
.k {
  font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.k:focus-visible { outline-offset: -4px; }
/* The map sits beside "Karachi", sized from the headline itself so the two never collide. */
.place {
  position: absolute; left: 0; top: 51%; width: 2.55em; aspect-ratio: 1.54;
  cursor: pointer; will-change: transform; letter-spacing: 0;
}
html.js .place { animation: fade 1.4s var(--ease) .5s both; }      /* opacity only: its position follows the scroll */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.hero-foot {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
  margin-top: auto; padding-top: calc(var(--step-display) * 0.86); will-change: opacity;
}
.hero-foot p { font-size: var(--step-lead); line-height: 1.25; letter-spacing: -0.02em; max-width: 44ch; }
.hero-foot .now { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
html:not(.js) .now { display: none; }
html.js .hero-foot > * { animation: up .8s var(--ease) .7s both; }
html.js .hero-foot > .now { animation-delay: .82s; }
@keyframes up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- work index ---------- */
.work {
  padding: clamp(48px, 6vw, 96px) var(--m) var(--pad);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gap);
  align-items: center;
}
.work h2 { font-size: var(--step-lead); letter-spacing: -0.02em; margin-bottom: clamp(20px, 4vw, 48px); }
.poster a { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 10px 0; text-decoration: none; }
.poster .name {
  font-size: var(--step-poster); font-weight: 600; letter-spacing: -0.035em; line-height: 1; white-space: nowrap;
  transition: color .3s, transform .6s var(--ease);
}
.poster .meta { color: var(--muted); white-space: nowrap; transition: color .3s; }
/* the project in hand is blue: the one under the pointer, or the one the object is showing */
.poster a.cur .name, .poster a:hover .name, .poster a:focus-visible .name { color: var(--accent); }
.poster a:hover .name, .poster a:focus-visible .name { transform: translateX(12px); }
.poster a.cur .meta, .poster a:hover .meta, .poster a:focus-visible .meta { color: var(--ink); }
.obj { display: block; width: 100%; height: clamp(240px, 54svh, 520px); }

/* ---------- project tiles ---------- */
.tile {
  padding: var(--pad) var(--m);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
  align-items: center;
}
.tile .copy { grid-column: 1 / span 4; grid-row: 1; }
.tile .stage { grid-column: 6 / span 7; grid-row: 1; }
.tile.flip .copy { grid-column: 9 / span 4; }
.tile.flip .stage { grid-column: 1 / span 7; }
.tile h3 { font-size: var(--step-head); }
.tagline { font-size: var(--step-lead); line-height: 1.14; letter-spacing: -0.02em; margin-top: 12px; }
.desc { margin-top: 28px; max-width: 44ch; }
.built { margin-top: 18px; color: var(--muted); max-width: 44ch; }
.tile .go { margin-top: 14px; }

.stage { perspective: 1500px; }
.shot {
  transform: translateY(var(--ty, 0px)) rotateX(var(--tilt, 0deg)) scale(var(--sc, 1));
  transform-origin: 50% 100%; will-change: transform;
}
.shot img { display: block; width: 100%; height: auto; }

/* ---------- pictures that are characters until you open them ---------- */
.ph { position: relative; overflow: hidden; background: #060607; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* no focus ring from a mouse or a finger on the pictures and the object; a clear one for the keyboard */
.ph, .obj, .place, .k { outline: none; }
html.kbd .ph:focus, html.kbd .obj:focus, html.kbd .k:focus { outline: 2px solid var(--accent); outline-offset: -3px; }
.ph canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; }
.ph img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; max-width: none;
  user-select: none; -webkit-user-drag: none;
  /* the photograph shows through a soft round window that the script opens from the pointer */
  opacity: var(--o, 0);
  -webkit-mask-image: radial-gradient(circle at var(--x, 50%) var(--y, 50%), #000 var(--r0, 0px), rgba(0, 0, 0, .5) calc((var(--r0, 0px) + var(--r1, 0px)) / 2), transparent var(--r1, 0px));
          mask-image: radial-gradient(circle at var(--x, 50%) var(--y, 50%), #000 var(--r0, 0px), rgba(0, 0, 0, .5) calc((var(--r0, 0px) + var(--r1, 0px)) / 2), transparent var(--r1, 0px));
  transform: scale(var(--s, 1.045)); will-change: transform;
}
html:not(.js) .ph img { opacity: 1; -webkit-mask-image: none; mask-image: none; transform: none; }

/* ---------- interests ---------- */
.interests {
  padding: var(--pad) var(--m);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: clamp(32px, 4vw, 56px);
}
.interests h2 { grid-column: 1 / -1; font-size: var(--step-head); }
.interests article { grid-column: span 6; }
.interests .ph, .interests .chartbox { aspect-ratio: 16 / 9; width: 100%; }
.interests .chartbox canvas { display: block; width: 100%; height: 100%; }
.interests h3 { font-size: var(--step-lead); letter-spacing: -0.02em; line-height: 1.14; margin-top: 26px; }
.interests p { margin-top: 12px; max-width: 52ch; }
.interests .go { margin-top: 6px; }

/* ---------- photos ---------- */
.photos { padding: var(--pad) 0; }
.photos .head {
  padding: 0 var(--m); margin-bottom: clamp(24px, 4vw, 56px);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px 48px; flex-wrap: wrap;
}
.photos h2 { font-size: var(--step-head); }
.photos .head p { font-size: var(--step-lead); line-height: 1.2; letter-spacing: -0.02em; color: var(--muted); }
.row {
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 0 var(--m); scroll-padding-inline: var(--m);
  scrollbar-width: none; cursor: grab;
}
.row::-webkit-scrollbar { display: none; }
.row.dragging { cursor: grabbing; scroll-behavior: auto; }
.row .ph { flex: none; height: clamp(230px, 58svh, 640px); aspect-ratio: var(--ar, 1.5); max-width: 88vw; }

/* ---------- résumé ---------- */
.resume {
  padding: var(--pad) var(--m);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
  row-gap: clamp(48px, 7vw, 104px); align-items: start;
}
.resume .side { grid-column: 1 / span 4; }
.resume .wide { grid-column: 5 / span 8; }
.resume h2 { font-size: var(--step-head); margin-bottom: clamp(24px, 3vw, 44px); }
.facts-side li { padding: 0 0 18px; }
.facts-side .k2 { display: block; font-size: var(--step-small); color: var(--muted); }
.about { font-size: var(--step-lead); line-height: 1.32; letter-spacing: -0.02em; max-width: 34em; }
.lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px var(--gap); }
.lists h3 { font-size: var(--step-small); font-weight: 400; letter-spacing: 0; line-height: 1.47; color: var(--muted); margin-bottom: 10px; }
.lists li { padding: 4px 0; }

/* ---------- the close ---------- */
footer {
  min-height: min(78svh, 900px); padding: 36px var(--m) 28px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 64px;
}
.f-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 40px; flex-wrap: wrap; }
.f-top nav { display: flex; gap: clamp(16px, 2.4vw, 36px); }
footer a { text-decoration: none; }
.f-top a { padding: 10px 0; transition: color .2s; }
.f-top a:hover, .f-bot a:hover { color: var(--accent); }
.mail { font-size: clamp(2.25rem, min(12vw, 26svh), 13.5rem); font-weight: 700; letter-spacing: -0.04em; line-height: .95; overflow-wrap: anywhere; }
.mail a { display: inline-block; transition: transform .5s var(--ease), color .25s; }
.mail a:hover { transform: translateX(14px); color: var(--accent); }
.f-bot { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-top: 36px; font-size: var(--step-small); color: var(--muted); }
.f-bot a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- entrances ---------- */
html.js [data-reveal] {
  opacity: 0; transform: translateY(30px);
  transition: opacity .9s var(--ease) var(--d, 0ms), transform 1.1s var(--ease) var(--d, 0ms);
}
html.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- narrower than a laptop: the work list and its object stack ---------- */
@media (max-width: 1180px) {
  .work { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  .obj { height: clamp(220px, 44svh, 400px); }
  .poster .name { font-size: clamp(2.25rem, min(7.4vw, 11svh), 5.5rem); }
  .tile .copy { grid-column: 1 / span 5; }
  .tile.flip .copy { grid-column: 8 / span 5; }
}

/* ---------- tablets upright, and phones ---------- */
@media (max-width: 900px) {
  :root { --step-display: min(19vw, 30svh); }
  .hero { min-height: 0; }
  .place { top: 100%; margin-top: 14px; width: min(78vw, 66svh, 480px); }
  .hero-foot { margin-top: 0; padding-top: calc(min(78vw, 66svh, 480px) / 1.54 + 64px); }
  .hero-foot .now { display: none; }
  .tile { row-gap: 40px; }
  .tile .copy, .tile.flip .copy { grid-column: 1 / -1; grid-row: 1; }
  .tile .stage, .tile.flip .stage { grid-column: 1 / -1; grid-row: 2; }
  .desc, .built { max-width: 60ch; }
  .interests article { grid-column: 1 / -1; }
  .resume .side, .resume .wide { grid-column: 1 / -1; }
  .resume { row-gap: 44px; }
  .facts-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
  footer { min-height: 0; gap: clamp(72px, 18svh, 200px); }
}

/* ---------- phones upright ---------- */
@media (max-width: 640px) {
  :root { --step-display: min(22vw, 30svh); }
  .top { padding-block: 8px; }
  h1 .line + .line { text-align: left; }
  .poster .name { font-size: min(11.5vw, 12svh); }
  .poster a { flex-direction: column; gap: 4px; padding: 12px 0; }
  .poster a:hover .name { transform: none; }
  .obj { height: clamp(200px, 36svh, 280px); }
  .row .ph { height: clamp(220px, 46svh, 420px); }
  .facts-side { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lists { grid-template-columns: minmax(0, 1fr); }
  .mail { font-size: min(17vw, 26svh); }
  .mail .at { display: block; }
}
@media (max-width: 380px) {
  .top { font-size: 0.9375rem; }
  .top nav { gap: 10px; }
}

/* ---------- short and wide: phones on their side, small laptop windows ---------- */
@media (max-height: 520px) and (min-width: 641px) {
  .hero { padding-top: 54px; }
  .interests .ph, .interests .chartbox { aspect-ratio: 21 / 9; }
  .work { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, .top { transition: none; }
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  html.js h1 .line-in, html.js .hero-foot > *, html.js .place { animation: none; }
  .poster .name, .mail a, .btn, .go span { transition: none; }
  .poster a:hover .name, .mail a:hover { transform: none; }
}
