/* zaki ullah: photography portfolio.
   One accent at a time, photo first. Motion system: ease-out for entrances and hovers, ease-in-out for
   transitions and panels, durations 400 / 800 / 1200 ms, stagger 60 ms. No other curves or durations. */

@font-face { font-family: 'Geist'; src: url(/fonts/geist.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(/fonts/geist-mono.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url(/fonts/instrument-serif-italic.woff2) format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }

/* Registered so the page colors can ease between themes and projects. */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #F2F2EF; }
@property --fg { syntax: '<color>'; inherits: true; initial-value: #121314; }
@property --muted { syntax: '<color>'; inherits: true; initial-value: #6B6E70; }
@property --line { syntax: '<color>'; inherits: true; initial-value: #D8D9D5; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #E2571B; }

:root {
  --bg: #F2F2EF; --fg: #121314; --muted: #6B6E70; --line: #D8D9D5; --accent: #E2571B; --on: #111111;
  --sans: 'Geist', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);
  --d-s: 400ms; --d-m: 800ms; --d-l: 1200ms; --stagger: 60ms;
  --gutter: clamp(16px, 4vw, 56px);
  --gap: 12px;
  color-scheme: light;
  transition: --bg var(--d-m) var(--ease-out), --fg var(--d-m) var(--ease-out), --muted var(--d-m) var(--ease-out),
    --line var(--d-m) var(--ease-out), --accent var(--d-m) var(--ease-out);
}
:root[data-theme='dark'] {
  --bg: #0D0E0F; --fg: #EDEDEA; --muted: #8C9092; --line: #252729; --accent: #F0703A; --on: #111111;
  color-scheme: dark;
}
/* Project pages: tokens are baked into the page by scripts/build-pages.mjs (--pl-* light, --pd-* dark). */
:root.project { --bg: var(--pl-bg); --fg: var(--pl-fg); --muted: var(--pl-muted); --line: var(--pl-line); --accent: var(--pl-accent); --on: var(--pl-on); }
:root.project[data-theme='dark'] { --bg: var(--pd-bg); --fg: var(--pd-fg); --muted: var(--pd-muted); --line: var(--pd-line); --accent: var(--pd-accent); --on: var(--pd-on); }

/* Cross-document page transitions (View Transitions API); other browsers just navigate. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--d-s); animation-timing-function: var(--ease-out); }
::view-transition-group(proj-img) { animation-duration: var(--d-m); animation-timing-function: var(--ease-inout); }
::view-transition-old(proj-img), ::view-transition-new(proj-img) { height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100svh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -60px; background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 200; }
.skip:focus { top: 8px; }
.mono { font: 400 11px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.serif, em.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.mask { display: block; overflow: hidden; }
.mask > * { display: block; }

/* Header / footer */
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 22px var(--gutter); position: relative; z-index: 10; }
.brand { font: 500 15px/1 var(--sans); letter-spacing: -.02em; }
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--muted); transition: color var(--d-s) var(--ease-out); }
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--fg); }
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px 24px;
  padding: 28px var(--gutter) 32px; margin-top: 72px; border-top: 1px solid var(--line); color: var(--muted);
}
.site-footer a:hover { color: var(--fg); }
.foot-mid { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.theme-btn { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); transition: color var(--d-s) var(--ease-out), border-color var(--d-s) var(--ease-out); }
.theme-btn:hover { color: var(--fg); border-color: var(--fg); }

/* Pills */
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; display: inline-block; will-change: transform; transition: background-color var(--d-s) var(--ease-out), color var(--d-s) var(--ease-out), border-color var(--d-s) var(--ease-out); }
.chip:hover { border-color: var(--fg); }
.chip[aria-pressed='true'] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Home: hero (name behind the car) ---------- */
.hero { position: relative; width: 100%; height: min(66.67vw, 86svh); min-height: 240px; overflow: hidden; background: var(--hero-avg, #C9C6BE); --nfs: 19vw; --nby: 44vw; }
.hero-in { position: absolute; inset: 0; transform: scale(1.03); }
.hero .lay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--hero-py, 70%); will-change: transform; user-select: none; -webkit-user-drag: none; }
.hero .name {
  position: absolute; left: 0; right: 0; top: calc(var(--nby) - .8em); text-align: center; z-index: 1;
  font: 700 var(--nfs)/1 var(--sans); letter-spacing: -.07em; color: #FBFAF6; white-space: nowrap; will-change: transform; pointer-events: none;
}
.hero .name .mask { padding: .12em .1em .04em; margin: -.12em 0 -.04em; }
.hero .cut { z-index: 2; pointer-events: none; }
.hero.nocut::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .38), rgba(0, 0, 0, 0) 55%); z-index: 1; pointer-events: none; }
.hero-meta { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 14px; z-index: 3; display: flex; justify-content: space-between; color: #fff; mix-blend-mode: difference; pointer-events: none; }

/* Focus pull text */
.focus { padding: clamp(56px, 10vw, 140px) var(--gutter) 0; position: relative; }
.focus .ln { display: block; width: max-content; max-width: 100%; letter-spacing: -.055em; text-wrap: balance; line-height: .98; font-weight: 500; will-change: filter; cursor: default; padding-bottom: .06em; }
.focus .ln:nth-child(1) { font-size: clamp(38px, 9vw, 132px); }
.focus .ln:nth-child(2) { font-size: clamp(32px, 7.4vw, 108px); padding-left: 9%; color: color-mix(in srgb, var(--fg) 88%, var(--bg)); }
.focus .ln:nth-child(3) { font-size: clamp(28px, 6vw, 88px); padding-left: 21%; color: color-mix(in srgb, var(--fg) 76%, var(--bg)); }
.focus .ln:nth-child(4) { font-size: clamp(14px, 1.5vw, 18px); padding-left: 21%; margin-top: 20px; color: var(--muted); letter-spacing: 0; font-weight: 400; }
.focus .ln em { font-family: var(--serif); font-weight: 400; letter-spacing: -.02em; font-size: 1.08em; }
.focus-read { position: absolute; right: var(--gutter); top: clamp(56px, 10vw, 140px); color: var(--muted); }
.about .focus { padding-top: clamp(24px, 6vw, 80px); }

/* Selected work */
.selected { padding: clamp(64px, 11vw, 150px) var(--gutter) 0; }
.sel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.sel-head h2 { font: 500 clamp(26px, 3.6vw, 48px)/1 var(--sans); letter-spacing: -.045em; }
.sel-head h2 em { font-size: 1.08em; }
.sel-note { color: var(--muted); }

/* Justified rows, CSS only: every tile grows by its aspect ratio, so rows fill the width and keep it. */
.wall { --rh: clamp(120px, 21vw, 290px); display: flex; flex-wrap: wrap; gap: 22px var(--gap); list-style: none; margin: 0; padding: 0; }
.wall::after { content: ''; flex-grow: 1e6; }
.tile { flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--rh)); min-width: 0; position: relative; }
.tile[hidden] { display: none; }
.tile a { display: block; position: relative; aspect-ratio: var(--r); background: var(--avg, var(--line)); overflow: hidden; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile figcaption, .tile .cap { margin-top: 8px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.tile figure { margin: 0; }
.tile.rise { animation: rise var(--d-m) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--stagger)); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Crop marks: four brackets that snap to the photo under the cursor. */
.crop { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; opacity: 0; color: var(--crop, var(--accent));
  transition: transform var(--d-s) var(--ease-out), width var(--d-s) var(--ease-out), height var(--d-s) var(--ease-out), opacity var(--d-s) var(--ease-out); }
.crop.on { opacity: 1; }
.crop.jump { transition: opacity var(--d-s) var(--ease-out); }
.crop i { position: absolute; width: 16px; height: 16px; border: 0 solid currentColor; }
.crop i:nth-of-type(1) { left: 0; top: 0; border-left-width: 1.5px; border-top-width: 1.5px; }
.crop i:nth-of-type(2) { right: 0; top: 0; border-right-width: 1.5px; border-top-width: 1.5px; }
.crop i:nth-of-type(3) { left: 0; bottom: 0; border-left-width: 1.5px; border-bottom-width: 1.5px; }
.crop i:nth-of-type(4) { right: 0; bottom: 0; border-right-width: 1.5px; border-bottom-width: 1.5px; }
.crop .lbl { position: absolute; left: 14px; bottom: 14px; padding: 2px 7px; background: var(--bg); color: var(--fg); white-space: nowrap; }
.crop .flash { position: absolute; inset: 6px; background: #fff; opacity: 0; }
@media (hover: none) { .crop { display: none; } }

/* ---------- Project page ---------- */
.p-cover { position: relative; margin: 0; background: var(--avg, var(--line)); overflow: hidden; }
.p-cover button { display: block; width: 100%; cursor: zoom-in; }
.p-cover img { width: 100%; height: auto; max-height: 82svh; object-fit: cover; view-transition-name: proj-img; }
.p-title { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px 48px; align-items: end; padding: clamp(28px, 5vw, 64px) var(--gutter) 0; }
.p-title h1 { font: 500 clamp(36px, 6.6vw, 96px)/.95 var(--sans); letter-spacing: -.055em; text-wrap: balance; }
.p-title h1 em { font-size: 1.08em; }
.p-cat { margin-bottom: 14px; color: var(--accent); }
.p-side { display: grid; gap: 10px; color: var(--muted); justify-items: start; }
.p-side .note { color: var(--fg); max-width: 42ch; }
.p-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.bat { display: inline-flex; gap: 12px; align-items: center; background: var(--accent); color: var(--on); border-radius: 999px; padding: 9px 16px; font: 500 13px/1 var(--sans); will-change: transform; }
.bat b { font-weight: 700; }
.p-info { padding: 32px var(--gutter) 0; display: flex; gap: 12px 28px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.palette { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; }
.palette li { display: flex; align-items: center; gap: 6px; }
.palette i { width: 14px; height: 14px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 16%, transparent); }
.mosaic { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap); padding: clamp(28px, 4vw, 56px) var(--gutter) 0; }
.mosaic .mcol { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.mosaic .frame { display: block; width: 100%; background: var(--avg, var(--line)); cursor: zoom-in; position: relative; overflow: hidden; }
.mosaic .frame img { width: 100%; height: auto; }
.mosaic:not(.js) { display: block; columns: 2; column-gap: var(--gap); }
.mosaic:not(.js) .frame { margin-bottom: var(--gap); break-inside: avoid; }
@media (min-width: 700px) { .mosaic:not(.js) { columns: 3; } }
@media (min-width: 1100px) { .mosaic:not(.js) { columns: 4; } }
.next { display: grid; gap: 6px; padding: clamp(56px, 9vw, 120px) var(--gutter) 0; justify-items: start; }
.next .big { font: 500 clamp(28px, 5.4vw, 72px)/1 var(--sans); letter-spacing: -.05em; will-change: transform; display: inline-block; border-bottom: 1.5px solid var(--accent); padding-bottom: .08em; }
.back-link { color: var(--muted); }

/* Color readout: fixed in the corner, never over the photo cursor */
.readout { position: fixed; right: var(--gutter); bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 7px 11px; color: var(--muted);
  background: color-mix(in srgb, var(--bg) 90%, transparent); border: 1px solid var(--line); transition: color var(--d-s) var(--ease-out); backdrop-filter: blur(6px); }
.readout.active { color: var(--fg); }
.readout .sw { width: 12px; height: 12px; background: var(--sw, var(--accent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 25%, transparent); flex: none; }
.readout .nm { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .readout .rgb { display: none; } }

/* Lightbox */
.lb { border: 0; padding: 0; background: var(--bg); color: var(--fg); width: 100vw; height: 100svh; max-width: none; max-height: none; }
.lb::backdrop { background: var(--bg); }
.lb-inner { height: 100%; display: grid; grid-template-rows: auto 1fr auto; padding: 14px var(--gutter); gap: 10px; }
.lb-top, .lb-bottom { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb .arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; padding: 14px; color: var(--fg); }
.lb .arrow.prev { left: -6px; } .lb .arrow.next { right: -6px; }

/* ---------- All work ---------- */
.work-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 4px var(--gutter) 16px; }
body.canvas-page { height: 100svh; overflow: hidden; }
.canvas-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: color-mix(in srgb, var(--fg) 5%, var(--bg)); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.canvas-stage.drag { cursor: grabbing; }
.canvas-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.canvas-read { position: absolute; left: var(--gutter); bottom: 12px; color: var(--muted); pointer-events: none; }
.canvas-foot { position: absolute; right: var(--gutter); bottom: 12px; color: var(--muted); display: flex; gap: 14px; align-items: baseline; }
.canvas-foot a:hover { color: var(--fg); }
.work-grid { padding: 8px var(--gutter) 0; }
.work-grid .group { margin-bottom: 36px; }
.work-grid .group > h2 { font: 400 11px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.view-canvas .work-grid { display: none; }
.view-grid .canvas-stage { display: none; }
.view-grid body.canvas-page, body.canvas-page.view-grid { height: auto; overflow: visible; }

/* About */
.about-body { padding: clamp(40px, 7vw, 96px) var(--gutter) 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px 48px; }
.about-body .bio p { font: 400 clamp(17px, 1.9vw, 22px)/1.4 var(--sans); letter-spacing: -.02em; max-width: 36ch; margin-bottom: 1em; }
.about-body dl { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 18px 16px; }
.about-body dt { color: var(--muted); padding-top: 3px; }
.about-body dd { margin: 0; }
.about-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.about-body a { border-bottom: 1px solid var(--accent); }
@media (max-width: 760px) { .about-body { grid-template-columns: 1fr; } .p-title { grid-template-columns: 1fr; } .about-body dl { grid-template-columns: 90px 1fr; } }

/* ---------- Opening sequence (first visit per session) ---------- */
.veil { position: fixed; inset: 0; z-index: 100; background: #121314; color: #EDEDEA; transform-origin: 50% 0; display: none; }
html.intro .veil { display: block; }
.veil .count { position: absolute; left: var(--gutter); bottom: 7vh; font: 400 clamp(72px, 17vw, 240px)/.85 var(--sans); letter-spacing: -.06em; font-variant-numeric: tabular-nums; overflow: hidden; padding: 0 .1em .06em 0; }
.veil .lbl { position: absolute; right: var(--gutter); bottom: 7vh; color: #8C9092; }
.veil .line { position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(7vh - 18px); height: 1px; background: #3A3C3F; }
.veil .line i { position: absolute; inset: 0; background: #EDEDEA; transform-origin: 0 50%; transform: scaleX(0); }
html.intro .rise-in { transform: translateY(110%); }
html.intro .hero-in { transform: scale(1.12); }

/* 404 */
.nf { padding: clamp(60px, 12vw, 160px) var(--gutter); }
.nf h1 { font: 500 clamp(40px, 8vw, 110px)/.95 var(--sans); letter-spacing: -.055em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-delay: 0s !important; }
  :root { transition: none; }
}

/* small additions */
.brand, .site-nav a { display: block; }
.focus h1 { font: inherit; letter-spacing: inherit; }
.p-title h1 .mask { padding: .04em 0 .1em; margin-bottom: -.1em; }
.p-cat .mask, .p-meta .mask, .note .mask { padding-bottom: .1em; }
.p-meta .rise { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.p-info .hint { margin-left: auto; }
@media (max-width: 760px) { .p-info .hint { margin-left: 0; } }
.mono-dl { font-family: var(--sans); }
.view-canvas .site-footer { display: none; }
.canvas-read, .canvas-foot { background: color-mix(in srgb, var(--bg) 88%, transparent); padding: 4px 9px; }
.about .focus .ln:nth-child(1) { font-size: clamp(30px, 7.2vw, 104px); }
.about .focus .ln:nth-child(2) { font-size: clamp(26px, 6vw, 88px); }
.about .focus .ln:nth-child(3) { font-size: clamp(24px, 5vw, 72px); }
