/* Zain Safdar portfolio. Built on the "Zain Safdar" (mn-) design system:
   black ground, off-white condensed capitals, flat square colour tiles, no gradients or shadows. */

:root {
  --surface: #121212;
  --surface-raised: #1d1d1b;
  --ink: #f1efe9;
  --ink-muted: #a9a69e;
  --line: #6e6c66;
  --orange: #f2663a;
  --green: #4b9b1f;
  --yellow: #f9cb0f;
  --lilac: #df8cff;
  --on-accent: #121212;
  --focus: #f9cb0f;

  --font-display: "Anton", "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --font-body: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;

  --space-4: 4px; --space-8: 8px; --space-16: 16px; --space-24: 24px;
  --space-32: 32px; --space-64: 64px; --space-96: 96px;
  --radius-pill: 999px;
  --gut: clamp(16px, 4vw, 64px);
  --ease: cubic-bezier(.7, 0, .2, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --surface: #f1efe9;
  --surface-raised: #e6e3da;
  --ink: #121212;
  --ink-muted: #55524b;
  --line: #8a867c;
  --focus: #121212;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 17px/26px var(--font-body); overflow-x: hidden; transition: background-color .3s, color .3s; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: fixed; left: 8px; top: -80px; z-index: 200; background: var(--yellow); color: var(--on-accent); padding: 12px 16px; font-weight: 700; }
.skip:focus { top: 8px; }

/* ---------- Design system primitives ---------- */
.mn-display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; line-height: .9; margin: 0; }
.mn-tagline { font-family: var(--font-body); font-weight: 700; letter-spacing: -.03em; line-height: .98; margin: 0; }
.mn-label { font-family: var(--font-body); font-weight: 700; font-size: 12px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; }

.mn-tile { display: inline-grid; place-items: center; width: 96px; height: 96px; color: var(--on-accent); flex: none; }
.mn-tile svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.mn-tile--sm { width: 40px; height: 40px; }
.mn-tile--fluid { width: .8em; height: .8em; }
.mn-tile--fluid-xl { width: clamp(120px, 20vw, 300px); height: clamp(120px, 20vw, 300px); }
.mn-tile--fluid-lg { width: clamp(90px, 13vw, 190px); height: clamp(90px, 13vw, 190px); }
.mn-tile--inline { width: .9em; height: .9em; vertical-align: -.1em; margin-inline: .08em; }
.mn-tile--orange { background: var(--orange); }
.mn-tile--green { background: var(--green); }
.mn-tile--yellow { background: var(--yellow); }
.mn-tile--lilac { background: var(--lilac); }

.mn-btn { display: inline-flex; align-items: center; gap: var(--space-8); border: 2px solid var(--ink); background: var(--ink); color: var(--surface); font: 700 14px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: 16px var(--space-24); border-radius: 0; cursor: pointer; transition: background-color .12s, color .12s, border-color .12s; }
.mn-btn:hover { background: var(--yellow); border-color: var(--yellow); color: var(--on-accent); }
.mn-btn--accent { background: var(--orange); border-color: var(--orange); color: var(--on-accent); }
.mn-btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); padding: 12px 18px; }
.mn-chip { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: var(--radius-pill); color: var(--ink); font: 700 12px/16px var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: 4px 12px; background: transparent; }
.mn-chip--orange { background: var(--orange); border-color: var(--orange); color: var(--on-accent); }
.mn-chip--green { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.mn-chip--yellow { background: var(--yellow); border-color: var(--yellow); color: var(--on-accent); }
.mn-chip--lilac { background: var(--lilac); border-color: var(--lilac); color: var(--on-accent); }
.mn-card__name { font-family: var(--font-display); text-transform: uppercase; font-size: 32px; line-height: 1; font-weight: 400; margin: 0; }
.mn-card__meta { color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.mn-card__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-16); flex-wrap: wrap; }

/* Rolling text label: second copy slides up on hover */
.roll { position: relative; display: inline-block; overflow: hidden; white-space: nowrap; line-height: 1.15; }
.roll > span, .roll::after { display: block; transition: transform .45s var(--ease); }
.roll::after { content: attr(data-text); position: absolute; left: 0; top: 100%; }
.mn-btn:hover .roll > span, .mn-btn:hover .roll::after, .mn-btn:focus-visible .roll > span, .mn-btn:focus-visible .roll::after { transform: translateY(-100%); }

/* ---------- Text split helpers ---------- */
.word { display: inline-block; white-space: nowrap; }
.char-mask { display: inline-block; overflow: hidden; vertical-align: top; padding-top: .08em; margin-top: -.08em; padding-bottom: .02em; }
.char { display: inline-block; will-change: transform; }
.w { display: inline-block; }

/* ---------- Chrome: loader, cursor, header, progress ---------- */
.loader { display: none; position: fixed; inset: 0; z-index: 100; background: var(--surface); }
.has-js .loader { display: block; }
.loader__cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); z-index: 2; }
.loader__cols i { display: block; transform: scaleY(0); transform-origin: bottom; }
.loader__top, .loader__bottom { position: absolute; left: var(--gut); right: var(--gut); display: flex; justify-content: space-between; gap: 16px; z-index: 3; }
.loader__top { top: 24px; } .loader__bottom { bottom: 24px; }
.loader__num { position: absolute; left: var(--gut); bottom: 56px; font-size: clamp(120px, 34vw, 520px); z-index: 3; font-variant-numeric: tabular-nums; }
.loader__top, .loader__bottom, .loader__num { mix-blend-mode: normal; }

.cursor { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; width: 14px; height: 14px; background: var(--yellow); display: none; place-items: center; transition: width .3s var(--ease), height .3s var(--ease), background-color .2s; }
.cursor span { font: 700 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--on-accent); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.cursor.is-big { width: 92px; height: 92px; background: var(--yellow); }
.cursor.is-big span { opacity: 1; }
@media (pointer: fine) { .has-js .cursor { display: grid; } .has-js, .has-js a, .has-js button { cursor: none; } }

.progress { position: fixed; left: 0; top: 0; height: 4px; width: 100%; background: var(--orange); transform: scaleX(0); transform-origin: left; z-index: 80; }

.header { position: fixed; z-index: 70; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gut); color: var(--ink); background: var(--surface); border-bottom: 2px solid var(--line); transition: background-color .3s, color .3s; }
.header__logo { display: inline-flex; align-items: center; gap: 10px; }
.header__logo::before { content: ""; width: 12px; height: 12px; background: var(--yellow); }
.header__nav { display: flex; gap: 32px; position: absolute; left: 50%; transform: translateX(-50%); }
.header__end { display: flex; align-items: center; gap: 20px; }
.theme-btn { background: none; border: 2px solid currentColor; padding: 6px 12px; cursor: pointer; color: var(--ink); }
.theme-btn:hover { background: var(--yellow); border-color: var(--yellow); color: var(--on-accent); }
.scramble { display: inline-block; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between; padding: 88px 0 var(--space-32); overflow: hidden; }
.hero__title { display: flex; flex-direction: column; font-size: min(23vw, 36svh); margin: auto 0; }
.hero__row { display: flex; align-items: center; gap: .04em; white-space: nowrap; will-change: transform; }
.hero__row--1 { padding-left: var(--gut); }
.hero__row--2 { justify-content: flex-end; padding-right: 0; margin-right: -.04em; }
.hero__row--2 .mn-tile:first-child { margin-right: .02em; }
.hero__word { font-size: 1em; line-height: .88; }
.hero__tile3 { margin-right: 0; }
.hero__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 0 var(--gut); flex-wrap: wrap; }
.hero__meta { display: flex; flex-direction: column; gap: 10px; }
.hero__avail { display: inline-flex; align-items: center; gap: 10px; }
.hero__avail i { width: 10px; height: 10px; background: var(--green); display: inline-block; animation: pulse 1.6s steps(2, jump-none) infinite; }
@keyframes pulse { 50% { background: var(--yellow); transform: scale(1.4); } }
.hero__scroll { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.hero__scroll svg, .wintro__hint svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.hero__tag { font-size: clamp(26px, 4.2vw, 56px); text-align: right; margin-left: auto; display: flex; flex-direction: column; }
.hero__tag span { display: block; overflow: hidden; padding-bottom: .06em; }
.hero__tag span > * { display: block; }

/* ---------- Marquees ---------- */
.marqs { padding: var(--space-64) 0; display: flex; flex-direction: column; gap: var(--space-16); overflow: hidden; border-block: 2px solid var(--line); }
.marq { overflow: hidden; }
.marq__track { display: flex; width: max-content; will-change: transform; }
.marq__set { display: flex; align-items: center; gap: var(--space-24); padding-right: var(--space-24); font-size: clamp(64px, 11vw, 170px); flex: none; }
.marq__set .mn-display { font-size: 1em; white-space: nowrap; }
.marq__set .mn-tile { width: .8em; height: .8em; }
.marq--outline .mn-display { color: transparent; -webkit-text-stroke: 2px var(--ink); }
.marq--foot .marq__set { font-size: clamp(40px, 7vw, 100px); }
.marq--foot .mn-tile--sm { width: .6em; height: .6em; }

/* ---------- Statement ---------- */
.statement { padding: clamp(96px, 16vw, 220px) var(--gut); display: flex; flex-direction: column; gap: 32px; }
.statement__text { font-weight: 700; letter-spacing: -.035em; line-height: 1; font-size: clamp(32px, 6.4vw, 104px); max-width: 17em; text-wrap: balance; }
.statement .mn-tile--inline { transform-origin: center; }

/* ---------- Work (horizontal) ---------- */
.work { position: relative; height: 100svh; overflow: hidden; background: var(--surface); border-top: 2px solid var(--line); }
.work__hud { position: absolute; z-index: 5; left: var(--gut); right: var(--gut); bottom: 24px; display: flex; align-items: center; gap: 24px; color: var(--ink); }
.work__count { font-variant-numeric: tabular-nums; }
.work__count b { display: inline-block; min-width: 2ch; }
.work__bar { flex: 1; height: 4px; background: var(--line); position: relative; overflow: hidden; }
.work__bar i { position: absolute; inset: 0; background: var(--yellow); transform: scaleX(0); transform-origin: left; }
.work__track { display: flex; align-items: center; gap: clamp(24px, 4vw, 64px); height: 100%; width: max-content; padding: 76px var(--gut) 72px; will-change: transform; }
.wpanel { flex: none; height: 100%; display: flex; align-items: center; }
.wpanel--intro { gap: clamp(24px, 4vw, 64px); padding-right: 2vw; }
.wintro { font-size: min(28vw, 40svh); display: flex; flex-direction: column; }
.wintro > span { display: block; }
.wintro__side { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; align-self: flex-end; padding-bottom: 6svh; }
.wintro__side .mn-tagline { font-size: clamp(28px, 3vw, 44px); }
.wintro__hint { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.wpanel--end { flex-direction: column; justify-content: center; align-items: flex-start; gap: 32px; padding-inline: 4vw 8vw; }
.wend { font-size: min(24vw, 40svh); }

.wcard { flex: none; width: min(78vw, 540px); height: min(100%, 680px); background: var(--surface-raised); display: flex; flex-direction: column; position: relative; transform-origin: 50% 100%; }
.wcard__img { flex: 1; min-height: 0; position: relative; overflow: hidden; display: grid; place-items: center; color: var(--on-accent); }
.wcard__img .mn-chip { position: absolute; top: 16px; left: 16px; z-index: 2; }
.wcard__no { position: absolute; top: 12px; right: 16px; font-size: 56px; z-index: 2; }
.wcard__glyph { width: 62%; max-height: 80%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transition: transform .6s var(--ease); will-change: transform; }
.wcard:hover .wcard__glyph { transform: rotate(-8deg) scale(1.12); }
.wcard__body { padding: var(--space-16); display: flex; flex-direction: column; gap: 8px; }

/* ---------- Stack panels ---------- */
.stack { position: relative; }
.spanel { position: sticky; top: 0; height: 100svh; background: var(--bg); color: var(--on-accent); overflow: hidden; }
.spanel__in { position: relative; height: 100%; padding: 88px var(--gut) var(--space-32); display: flex; flex-direction: column; justify-content: space-between; transform-origin: 50% 0; }
.spanel__top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.spanel__top .mn-chip { border-color: var(--on-accent); color: var(--on-accent); }
.spanel__word { font-size: min(27vw, 42svh); margin-left: -.03em; position: relative; z-index: 1; }
.spanel__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; position: relative; z-index: 1; }
.spanel__copy { max-width: 34em; font-size: clamp(17px, 1.6vw, 22px); line-height: 1.35; font-weight: 500; }
.spanel__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.spanel__chips .mn-chip { border-color: var(--on-accent); color: var(--on-accent); }
.spanel__tile { position: absolute; right: var(--gut); top: 24%; z-index: 0; }

/* ---------- Toolbox ---------- */
.toolbox { padding: clamp(80px, 12vw, 160px) 0 clamp(64px, 8vw, 120px); }
.toolbox__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 0 var(--gut) 24px; flex-wrap: wrap; }
.toolbox__sub { color: var(--ink-muted); font-size: 14px; }
.tool { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 12px var(--gut); border-top: 2px solid var(--line); overflow: hidden; isolation: isolate; color: var(--ink); transition: color .25s; }
.tool:last-child { border-bottom: 2px solid var(--line); }
.tool::before { content: ""; position: absolute; inset: 0; background: var(--yellow); transform: scaleY(0); transform-origin: bottom; transition: transform .5s var(--ease); z-index: -1; }
.tool:hover { color: var(--on-accent); }
.tool:hover::before { transform: scaleY(1); }
.tool__name { font-size: clamp(44px, 9.5vw, 150px); white-space: nowrap; transition: transform .5s var(--ease); }
.tool:hover .tool__name { transform: translateX(2vw); }
.tool__meta { display: flex; align-items: center; gap: 16px; text-align: right; }
.tool:hover .tool__meta .mn-chip { border-color: var(--on-accent); color: var(--on-accent); }
.tool__note { font-size: 14px; }

/* ---------- About ---------- */
.about { position: relative; height: 100svh; overflow: hidden; color: var(--on-accent); }
.about__bg { position: absolute; inset: 0; background: var(--yellow); clip-path: circle(22% at 50% 60%); }
.about__in { position: relative; height: 100%; padding: 96px var(--gut) var(--space-32); display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.about__main { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; position: relative; z-index: 2; }
.about__main .mn-chip { border-color: var(--on-accent); color: var(--on-accent); }
.about__title { font-size: min(22vw, 27svh); }
.about__copy { max-width: min(36em, 52vw); font-size: clamp(17px, 1.7vw, 24px); line-height: 1.35; font-weight: 500; }
.about__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; border-top: 2px solid var(--on-accent); padding-top: 16px; position: relative; z-index: 2; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: clamp(48px, 9vw, 140px); font-weight: 400; font-variant-numeric: tabular-nums; }
.about__fig { position: absolute; right: clamp(24px, 9vw, 160px); top: 15%; width: clamp(180px, 28vw, 400px); z-index: 1; margin: 0; }
.about__photo { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border: 3px solid var(--on-accent); background: var(--surface-raised); }
.about__t1, .about__t2 { position: absolute; width: 34%; height: 34%; }
.about__t1 { right: -12%; top: -12%; }
.about__t2 { left: -14%; bottom: -10%; width: 26%; height: 26%; }

/* ---------- Contact ---------- */
.contact { position: relative; min-height: 100svh; padding: clamp(96px, 12vw, 160px) var(--gut) var(--space-64); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; overflow: hidden; }
.contact__title { font-size: min(34vw, 44svh); display: flex; flex-direction: column; cursor: default; }
.wave-line { display: block; white-space: nowrap; overflow: hidden; padding-top: .04em; }
.wave-char { transition: color .2s; display: inline-block; will-change: transform; transform-origin: 50% 100%; }
.contact__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.contact__tag { font-size: clamp(28px, 4vw, 56px); }
.contact__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.contact__status { color: var(--green); min-width: 8ch; }
:root[data-theme="light"] .contact__status { color: #2f6310; }
.wave-char.is-hot { color: var(--orange); }
.about__title > span, .wend > span, .wintro > span { display: block; }
.confetti { position: fixed; left: 0; top: 0; width: 14px; height: 14px; pointer-events: none; z-index: 95; }

.footer { border-top: 2px solid var(--line); padding-top: var(--space-24); }
.footer__row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 24px var(--gut) 32px; flex-wrap: wrap; }
.footer__links { display: flex; gap: 24px; }
.totop { background: none; border: 0; cursor: pointer; padding: 0; }
.totop:hover { color: var(--yellow); }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .header__nav { display: none; }
  .header__clock { display: none; }
  .hero { padding-top: 76px; }
  .hero__foot { align-items: flex-start; }
  .hero__tag { margin-left: 0; text-align: left; }
  .spanel__tile { top: auto; bottom: 34%; width: 38vw; height: 38vw; }
  .tool__meta .tool__note { display: none; }
  .about__stats { grid-template-columns: repeat(3, 1fr); }
  .about__copy { max-width: none; }
  .about__fig { position: relative; right: auto; top: auto; width: min(44vw, 200px); align-self: flex-end; margin-right: 12px; }
  .work__hud { gap: 12px; }
  .wcard__no { font-size: 40px; }
}

/* ---------- Reduced motion: no pins, no scrub, plain scroll ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader { display: none !important; }
  .cursor { display: none !important; }
  .work { height: auto; overflow: visible; padding-block: 64px; }
  .work__hud { display: none; }
  .work__track { width: auto; overflow-x: auto; height: auto; padding-bottom: 32px; }
  .wcard { height: 520px; }
  .spanel { position: relative; }
  .about__bg { clip-path: none; }
  .marq__track { width: auto; overflow-x: auto; }
  .roll > span, .roll::after, .tool::before, .wcard__glyph { transition: none; }
  html.has-js, .has-js a, .has-js button { cursor: auto; }
}

/* Work card with a real app screenshot */
.wcard__shot { height: 88%; width: auto; max-width: 70%; object-fit: cover; object-position: top; border: 3px solid var(--on-accent); display: block; margin-top: 28px; will-change: transform; transition: transform .6s var(--ease); }
.wcard:hover .wcard__shot { transform: translateY(-2%) rotate(-2deg); }
.wcard__soon { color: var(--ink-muted); }
.wcard__body .mn-card__meta { font-size: 14px; }
.wcard__shot--full { width: 100%; max-width: none; height: 112%; border: 0; margin: 0; object-fit: cover; object-position: top; }
.wcard:hover .wcard__shot--full { transform: scale(1.04); }

/* Whole card is clickable via the Visit link */
.wcard__link::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.wcard:has(.wcard__link:hover) .wcard__glyph, .wcard:has(.wcard__link:hover) .wcard__shot { transform: scale(1.04); }
.wcard:has(.wcard__link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.wcard__link:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Hero flip tile: lilac sparkle on the front, photo on the back */
.flip { position: relative; perspective: 900px; cursor: pointer; }
.flip__in { position: absolute; inset: 0; transform-style: preserve-3d; }
.flip__face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip__front { background: var(--lilac); color: var(--on-accent); }
.flip__back { transform: rotateY(180deg); background: var(--surface-raised); }
.flip__back img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flip__tag { position: absolute; left: -4%; bottom: -3%; z-index: 2; font-size: clamp(10px, 1.1vw, 14px); white-space: nowrap; transform: rotate(-6deg); pointer-events: none; opacity: 0; }
@media (max-width: 800px) { .flip__tag { left: auto; right: 4%; bottom: -14%; } }
