/* 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: both lines on the left, sized so that a small map fits after its second line and
     the view behind the page has the rest of the screen. */
  --step-display: min(clamp(3.5rem, 10.4vw, 11rem), 22svh);

  --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; }
button { -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: 0; border-radius: 999px;
  background: #0071e3; color: #fff; font: inherit; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .25s var(--ease), background-color .2s;
}
.btn:hover { background: #1482f5; }
.btn:active { transform: scale(.96); }
.btn.quiet { background: #1d1d1f; color: var(--ink); }
.btn.quiet:hover { background: #2a2a2d; }
.btn[hidden] { display: none; }

/* A link inside a sentence: blue, with no line under it until it is pointed at, when one draws itself
   in from the left. Pointing at it also brings up a picture of where it leads (.peek, below). */
.link { position: relative; color: var(--accent); text-decoration: none; white-space: nowrap; transition: color .2s; }
.link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; background: currentColor;
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .4s var(--ease);
}
.link:hover::after, .link:focus-visible::after { transform: scaleX(1); }
.link:active { color: #7cc0ff; }
/* The picture of the page a link leads to. The script moves it: it trails the pointer and leans the way it is going. */
.peek {
  position: fixed; left: 0; top: 0; z-index: 30; width: min(400px, 44vw); aspect-ratio: 16 / 10;
  border-radius: 14px; overflow: hidden; background: #0c0c0d;
  pointer-events: none; opacity: 0; visibility: hidden; will-change: transform, opacity;
}
.peek img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The card for a constellation, beside the star the pointer has picked in the view's night sky:
   a photograph of that part of the sky, the constellation's name, the star's. The script places it. */
.skycard {
  position: fixed; left: 0; top: 0; z-index: 30; width: 228px;
  pointer-events: none; visibility: hidden; transition: transform .32s var(--ease), visibility 0s .2s;
}
.skycard.on { visibility: visible; transition: transform .32s var(--ease); }
.skycard.still { transition: none; }                      /* put in place at once: only a move while it is showing is eased */
.skycard .sc-in {
  padding: 10px 10px 12px; border-radius: 14px; background: #0c0c0d;
  opacity: 0; transform: translateY(6px) scale(.97); transform-origin: 50% 40%;
  transition: opacity .16s ease-out, transform .16s ease-out;
}
.skycard.on .sc-in { opacity: 1; transform: none; transition: opacity .22s ease-out, transform .36s var(--ease); }
.skycard img { display: block; width: 100%; height: auto; border-radius: 8px; margin-bottom: 10px; background: #060607; opacity: 0; transition: opacity .28s; }
.skycard img.in { opacity: 1; }
.skycard img[hidden], .skycard p[hidden] { display: none; }
html.starry { cursor: pointer; }                           /* the pointer is on a star (Field in ascii.js sets this) */
.skycard .sc-name { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.skycard .sc-star { margin-top: 3px; font-size: var(--step-small); line-height: 1.3; color: var(--muted); }
.skycard .sc-by { margin-top: 8px; font-size: 0.6875rem; line-height: 1.3; color: #6e6e73; }

.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, .tabs.away { transform: translateY(-101%); }
.mark { font-weight: 600; text-decoration: none; letter-spacing: -0.02em; padding: 10px 0; transition: color .2s; }
/* The section links. One list: along the top here, along the bottom on a phone (further down). */
.tabs {
  position: fixed; top: 0; right: var(--m); z-index: 21;
  display: flex; gap: clamp(12px, 2.2vw, 34px); padding: 12px 0;
  transition: transform .5s var(--ease);
}
.tabs a { text-decoration: none; padding: 10px 0; transition: color .2s; }
.tabs a:hover, .tabs a[aria-current="true"], .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; }
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: small, on the headline's second line, straight after "Karachi". The script measures the word and
   passes its width in --kw. About as tall as the letters, and sized in em, so it follows the headline. */
.place {
  position: absolute; left: calc(var(--kw, 3.5em) + .12em); bottom: .1em; width: 1.3em; aspect-ratio: 1.19;      /* the map's own shape */
  letter-spacing: 0;
}
html.js .place { animation: fade .7s var(--ease) .15s 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.9);
}
.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; }
/* Under the introduction: how long the Raspberry Pi that serves this site took to answer just now (main.js asks it and
   fills this in). Its line is there from the start, empty, so nothing moves when the words come. A link to /pi, and
   seen to be one by its underline, not by being blue. */
.hero-foot .served { min-height: 1.45em; margin-top: 10px; max-width: none; font-size: var(--step-small); line-height: 1.45; letter-spacing: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.served a { padding: 8px 0; color: inherit; text-decoration: underline; text-decoration-color: rgba(161, 161, 166, .5); text-underline-offset: 3px; visibility: hidden; opacity: 0; transition: opacity .5s, color .2s, text-decoration-color .2s, visibility 0s; }
.served a.on { visibility: visible; opacity: 1; }
.served a:hover { color: var(--ink); text-decoration-color: currentColor; }
html:not(.js) .served { 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; } }

/* ---------- hello, world: the first thing after the first screen ---------- */
.hello { padding: clamp(28px, 5vw, 80px) var(--m) 0; }
.hello canvas { display: block; width: 100%; aspect-ratio: 5.6; letter-spacing: 0; outline: 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); }
.dots { display: none; }

/* ---------- 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;
  color: transparent;                                     /* its description is for screen readers: never painted in the frame while the file is on its way */
  /* the photograph shows through a soft round window that the script opens: from the pointer, or as the page scrolls */
  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;
}
/* on a touch screen the photograph comes up whole (the characters dissolve): no window, so no mask to redraw every frame */
.ph.dis img { -webkit-mask-image: none; mask-image: none; }
html:not(.js) .ph img { opacity: 1; -webkit-mask-image: none; mask-image: none; transform: none; color: var(--muted); }

/* ---------- 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 4; }
.interests .ph, .interests .chartbox { aspect-ratio: 16 / 9; width: 100%; }
/* One frame that holds several photographs side by side, one showing at a time. */
.deck { position: relative; }
.deck-row { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: pointer; }
.deck-row::-webkit-scrollbar { display: none; }
.deck-row .ph { flex: 0 0 100%; scroll-snap-align: center; }
.pips { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: rgba(245, 245, 247, .5); box-shadow: 0 0 5px rgba(0, 0, 0, .55); transition: background-color .3s, transform .4s var(--ease); }      /* the soft dark edge keeps them readable on a pale photograph */
.pips i.on { background: var(--ink); transform: scale(1.35); }
.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); }
.photos h2 { font-size: var(--step-head); }
.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; }

/* ---------- contact ---------- */
footer { padding: var(--pad) var(--m) 28px; }
footer a { text-decoration: none; }
.f-say { font-size: var(--step-lead); line-height: 1.25; letter-spacing: -0.02em; color: var(--muted); }
/* The address and its copy button share one size, so the button scales with the letters. */
.mail-row {
  display: flex; align-items: center; gap: .1em;
  font-size: clamp(2.25rem, min(12vw, 26svh), 13.5rem);
  margin-top: 0.17em;                                    /* clear of the line above: the letters stand taller than their line */
}
.mail { font-size: 1em; font-weight: 700; letter-spacing: -0.04em; line-height: .95; white-space: nowrap; }
.mail a { display: inline-block; transition: transform .5s var(--ease), color .3s; }
.mail a:hover { transform: translateX(14px); color: var(--accent); }
/* Copy: the two sheets shrink away and a tick draws itself in their place, then it all goes back. */
.copybtn {
  position: relative; flex: none; width: max(44px, .36em); height: max(44px, .36em);
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
  font-size: inherit;                                    /* a button does not take its size from its parent unless told to */
  transition: color .2s, background-color .3s, transform .3s var(--ease);
}
.copybtn[hidden] { display: none; }
.copybtn:hover { color: var(--ink); background: #1d1d1f; }
.copybtn:active { transform: scale(.86); }
.copybtn svg {
  position: absolute; inset: 0; margin: auto; width: 46%; height: 46%;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: opacity .22s, transform .5s var(--ease);
}
.copybtn .i-check { opacity: 0; transform: scale(.4) rotate(-30deg); }
.copybtn .i-check path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .4s cubic-bezier(.65, 0, .35, 1) .1s; }
.copied {
  position: absolute; left: 50%; bottom: calc(100% + 6px); translate: -50% 6px;
  font-size: var(--step-small); font-weight: 400; letter-spacing: 0; line-height: 1; white-space: nowrap;
  color: #34c77b; opacity: 0; pointer-events: none;
  transition: opacity .25s, translate .45s var(--ease);
}
.done .copybtn, .done .copybtn:hover { color: #34c77b; background: rgba(52, 199, 123, .16); }
.done .copybtn .i-copy { opacity: 0; transform: scale(.4) rotate(30deg); }
.done .copybtn .i-check { opacity: 1; transform: none; }
.done .copybtn .i-check path { stroke-dashoffset: 0; }
.done .copied { opacity: 1; translate: -50% 0; }
.done .mail a { color: #34c77b; }
.f-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: clamp(22px, 2.6vw, 40px); }
.f-bot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; margin-top: clamp(36px, 5vw, 72px); font-size: var(--step-small); color: var(--muted); }
.f-bot a { padding: 13px 0; transition: color .2s; }
.f-bot a:hover { color: var(--accent); }

/* ---------- 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; }

/* ---------- touch screens: rows of pictures stop on a picture ---------- */
@media (hover: none) {
  .row { scroll-snap-type: x mandatory; cursor: auto; }
  .row .ph { scroll-snap-align: center; }
  .ph, .deck-row { cursor: auto; }
}

/* ---------- 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); }
  .interests article { grid-column: span 6; }
  .tile .copy { grid-column: 1 / span 5; }
  .tile.flip .copy { grid-column: 8 / span 5; }
}

/* ---------- tablets upright ---------- */
@media (max-width: 900px) {
  :root { --step-display: min(16vw, 22svh); }
  .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); }
}

/* ---------- phones upright ----------
   Built for one hand: the section links sit along the bottom, under the thumb, and stay there.
   The first screen is the view with the words under it, and scrolls away like any other part.
   Anything that comes in a set (projects, photographs, the résumé lists) is a row to swipe, one
   item at a time, instead of a long column. Everything tappable is at least 44px tall. */
@media (max-width: 640px) {
  :root {
    --step-display: min(20vw, 15svh);
    --step-head: 2.125rem;
    --bar: calc(54px + env(safe-area-inset-bottom, 0px));
    --card: calc(100vw - var(--m) * 2 - 4px);            /* one card, with a sliver of the next showing: its edge, never its words */
  }

  .top { padding-block: 8px; }
  .tabs {
    top: auto; right: 0; bottom: 0; left: 0; gap: 0;
    padding: 3px max(6px, env(safe-area-inset-right, 0px)) calc(3px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: rgba(16, 16, 17, .74);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  }
  .tabs.away { transform: none; }                         /* this bar stays put */
  .tabs a {
    flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 2px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8125rem; letter-spacing: 0; color: var(--muted);
  }
  .tabs a[aria-current="true"] { color: var(--accent); }

  /* first screen: the view on top, the words at the bottom where they are read last and reached first */
  .hero {
    min-height: 100svh; padding: 58px var(--m) calc(var(--bar) + 18px);
    justify-content: flex-end;
  }
  h1 { margin: 0; }
  .place { left: auto; right: 0; bottom: .14em; width: .9em; }      /* after "Karachi", against the right-hand margin */
  .hero-foot { display: block; margin-top: clamp(12px, 2.2svh, 20px); padding-top: 0; }
  .hero-foot p { font-size: 1.1875rem; line-height: 1.28; }
  .hero-foot .now { display: block; position: absolute; top: 19px; right: var(--m); font-size: var(--step-small); }

  /* everything after the first screen has a ground of its own here, so the view behind the page is never seen through it */
  main { position: relative; z-index: 1; background: var(--bg); }
  footer { position: relative; z-index: 1; background: var(--bg); }

  .hello { padding: 34px var(--m) 0; }
  .hello canvas { aspect-ratio: 1.19; }                   /* two lines here: "hello," over "world" */

  /* work: the object on top, and the projects as cards to swipe; the object turns into whichever card is in front */
  .work { display: block; padding: 34px var(--m) 0; }
  .work h2 { font-size: var(--step-head); letter-spacing: -0.03em; margin-bottom: 0; }
  .poster { display: none; }
  .obj { height: clamp(170px, 27svh, 250px); }
  .tiles {
    display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--m);
    padding: 6px var(--m) 2px; scrollbar-width: none;
  }
  .tiles::-webkit-scrollbar, .lists::-webkit-scrollbar { display: none; }
  .tile {
    flex: 0 0 var(--card); scroll-snap-align: start; scroll-snap-stop: always;
    display: flex; flex-direction: column; padding: 0;
    background: var(--tile); border-radius: 22px; overflow: hidden;
  }
  .tile .stage { order: -1; perspective: none; }
  .tile .shot { transform: none; }
  .tile .shot img { aspect-ratio: 16 / 10; object-fit: cover; object-position: 50% 0; }
  .tile .copy { flex: 1; display: flex; flex-direction: column; padding: 18px 18px 8px; }
  .tile h3 { font-size: 1.75rem; }
  .tagline { font-size: var(--step-body); margin-top: 6px; }
  .desc { margin-top: 14px; }
  .built { margin-top: 10px; font-size: var(--step-small); }
  .tile .go { margin-top: auto; padding: 14px 0 12px; }
  .tile .built:last-child { padding-bottom: 14px; }      /* a card with no link under it */
  html.js .tile [data-reveal] { opacity: 1; transform: none; transition: none; }      /* a card you swipe to is already there */
  .dots { display: flex; justify-content: center; gap: 7px; padding: 16px 0 48px; }
  .dots i { width: 6px; height: 6px; border-radius: 50%; background: #48484a; transition: background-color .3s, transform .4s var(--ease); }
  .dots i.on { background: var(--accent); transform: scale(1.4); }

  .interests { display: block; padding: 50px var(--m) 58px; background: var(--tile); }
  .interests article { margin-top: 26px; }
  .interests article + article { margin-top: 44px; }
  .interests h3 { margin-top: 18px; }
  .interests .go { padding: 14px 0 8px; }

  .photos { padding: 50px 0 58px; background: var(--bg); }
  .photos .head { margin-bottom: 22px; }
  .row { gap: 10px; }
  .row .ph { height: min(100vw, 58svh); max-width: var(--card); }

  .resume { display: block; padding: 50px var(--m) 58px; background: var(--tile); }
  .resume h2 { margin-bottom: 22px; }
  .facts-side { display: block; }
  .facts-side li { padding: 0 0 14px; }
  .about { margin-top: 18px; font-size: 1.25rem; }
  .lists {
    display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--m);
    margin: 30px calc(var(--m) * -1) 0; padding: 0 var(--m); scrollbar-width: none;
  }
  .lists > div { flex: 0 0 var(--card); scroll-snap-align: start; background: var(--bg); border-radius: 22px; padding: 18px 18px 14px; }

  footer { padding: 50px var(--m) calc(var(--bar) + 14px); }
  .f-say { font-size: 1.1875rem; }
  .mail-row { font-size: 10.6vw; gap: 6px; margin-top: 10px; }
  .done .copied { opacity: 0; }                           /* no room for the word here: the tick and the green address say it */
  .mail a:hover { transform: none; }
  .f-act { margin-top: 22px; }
  .f-act .btn { flex: 1 1 100%; }
  .f-bot { margin-top: 30px; }
}
@media (max-width: 350px) {
  .tabs a { font-size: 0.75rem; }
}

/* ---------- rows the script carries by hand on a touch screen (see swipe() in main.js) ----------
   It settles them on an item itself, and needs the sideways part of a swipe handed to it; the
   browser keeps the up-and-down part, and pinching. */
.row.swipe, .tiles.swipe, .lists.swipe, .deck-row.swipe { overflow-x: hidden; scroll-snap-type: none; touch-action: pan-y pinch-zoom; }
/* It moves them by sliding the items, all by the same amount in the same frame. It never scrolls the
   row: on an iPhone that leaves the items drawn at different offsets, overlapping and blanking out. */
.swipe > * { transform: translate3d(var(--tx, 0px), 0, 0); will-change: transform; }
html.js .lists.swipe > [data-reveal] { transform: translate3d(var(--tx, 0px), 0, 0); transition: opacity .9s var(--ease) var(--d, 0ms); }

/* ---------- 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, .tabs { 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, .link, .link::after, .dots i, .pips i, .copybtn, .copybtn svg, .copybtn .i-check path, .copied { transition: none; }
  .poster a:hover .name, .mail a:hover { transform: none; }
}

/* ---------- the view behind the first screen ----------
   One canvas fixed behind everything (Field in ascii.js): the view from Mubarak Village under a sky
   for the time of day, on every size but a phone held sideways. It steps back behind the words on
   and just after the first screen (the list is where the field is started, in main.js), and it is
   gone by the time the page has moved on, so nothing needs a panel under it.

   The black stays on <html>; <body> must not paint over the view, whatever tone the script asks
   for. On a phone that changes nothing to look at: everything after the first screen has a ground of
   its own there. */
/* The canvas is one screen tall and sticks to the top of a track that begins at the top of the page
   and is as tall as the opening (--settle, which the script measures) plus that one screen. So while
   the opening lasts the browser holds the canvas at the top of the screen, and from the moment the
   first screen has arrived it scrolls away with it. The script never moves it, so it cannot lag
   behind the page: on a phone, a picture moved by script trails a scroll by a frame or two, and
   that showed as a shake between the first screen and what follows. */
.track { display: none; }
html.js .track {
  display: block; position: absolute; left: 0; top: 0; z-index: -1; width: 100%;
  height: calc(var(--settle, 0px) + 100vh); height: calc(var(--settle, 0px) + 100lvh);
  pointer-events: none;
}
.ground {
  position: -webkit-sticky; position: sticky; top: 0; display: block;
  width: 100%; height: 100vh; height: 100lvh; max-width: none;
}
/* The view's characters are on a second canvas of the same size (the script adds it: see Sheet in ascii.js). It follows
   the first in the track and is pulled back up over it by its own height, so both are held, and let go, together. */
.ground.over { margin-top: -100vh; margin-top: -100lvh; }
body { background: transparent !important; }

/* One line at the foot of the page saying what the view is. Not on a phone held sideways, which has no view. */
.f-note { display: none; line-height: 1.4; }
.f-note a { padding: 0; text-decoration: underline; text-underline-offset: 2px; }      /* the photographer's name and the licence: links, and seen to be */
@media (max-width: 640px) {
  .f-note { display: block; flex-basis: 100%; }
}
@media (min-width: 641px) and (min-height: 521px) {
  body { transition: none; }
  .top.solid { background: #000; }                       /* the page is black all the way down here, and the bar's backing with it */
  .f-bot { align-items: flex-end; }
  .f-note { display: block; max-width: 56ch; text-align: right; }
}

/* ---------- the opening ----------
   The site starts on the view alone. .intro is the room for that: a spacer ahead of the first
   screen, there only where there is a view and a script to draw it. Scrolling brings the first
   screen up while the view folds down behind it (Field in ascii.js follows the scroll). The tab at
   the foot of the screen asks for the scroll, and can be pressed instead. While the opening lasts
   the bar keeps its place and has no backing. */
.intro { display: none; }
.cue {
  position: fixed; z-index: 5; left: 50%; bottom: 28px; translate: -50% 0;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: #1d1d1f; color: var(--ink);
  font: inherit; font-size: var(--step-small); letter-spacing: 0; cursor: pointer;
  transition: opacity .2s, background-color .2s;
}
.cue:hover { background: #2a2a2d; }
.cue[hidden] { display: none; }
.cue svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.opening .top { background: transparent; }
html.opening .top, html.opening .tabs { transform: none; }
@media (max-width: 640px) {
  html.js .intro { display: block; height: 50svh; }      /* the script sets the real height: enough to hold the headline just under the fold */
  .cue { bottom: calc(var(--bar) + 14px); }              /* over the bar of section links */
  html.opening .hero-foot .now { position: fixed; z-index: 21; top: 19px; right: var(--m); }      /* the clock keeps its corner while the first screen is on its way up */
}
@media (min-width: 641px) and (min-height: 521px) {
  html.js .intro { display: block; height: 100vh; height: 100svh; }
}
@media (prefers-reduced-motion: reduce) {
  .cue { transition: none; }
}

/* ---------- a phone: quick entrances ----------
   AK, 30 Nov 2026: scrolling felt jittery on his phone, and he asked for a fifth of a second where
   there had been half a second or more. A part that is still rising a second after it came into
   view reads, under a moving thumb, as the page stuttering. So here the entrances are short and
   barely travel, the first screen's own (which play before anyone has scrolled to it) are dropped,
   and the bar gets out of the way quickly. The photographs' dissolve is as short (ascii.js). */
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  html.js [data-reveal] {
    transform: translateY(10px);
    transition: opacity .2s ease-out calc(var(--d, 0ms) * .25), transform .2s ease-out calc(var(--d, 0ms) * .25);
  }
  html.js .lists.swipe > [data-reveal] { transition: opacity .2s ease-out; }
  html.js h1 .line-in, html.js .hero-foot > *, html.js .place { animation: none; }
  .top { transition: transform .2s ease-out, background-color .2s; }
}
