/* ==========================================================================
   Muhammad Usman Farooq — bio
   One typeface (Instrument Sans), light theme, one accent.
   Change the palette and rhythm in :root.
   ========================================================================== */

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/InstrumentSans-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f3f1;
  --card: #ffffff;
  --ink: #111111;
  --muted: #6a6a66;
  --line: #dededa;
  --accent: #2740f5;

  --font: "Instrument Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --max: 72rem;
  --radius: 1.5rem;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.icon { flex: none; }

.skip-link {
  position: absolute; left: var(--gutter); top: 0; z-index: 80;
  padding: 0.6rem 1rem; background: var(--ink); color: #fff; border-radius: 999px;
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0.75rem); }

/* Top row ---------------------------------------------------------------- */

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; }
.wordmark { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; }
.where { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9375rem; color: var(--muted); }

/* Dock ------------------------------------------------------------------- */

.dock {
  position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 50;
  display: flex; gap: 2px; padding: 6px;
  background: var(--ink); border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  transform: translateX(-50%);
}
.dock a {
  position: relative; z-index: 1;
  padding: 0.6rem 1.15rem; border-radius: 999px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.01em; text-decoration: none;
  transition: color 0.3s ease, background-color 0.3s ease;
}
.dock a:hover, .dock a[aria-current="true"] { color: #fff; }
.dock a:hover { background: rgba(255, 255, 255, 0.12); }
.js .dock a:hover { background: none; }
.dock :focus-visible { outline-color: #fff; outline-offset: -2px; }
.dock-pill {
  position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 0; width: 0;
  border-radius: 999px; background: rgba(255, 255, 255, 0.16); opacity: 0;
  transition: transform 0.55s var(--ease), width 0.55s var(--ease), opacity 0.3s ease;
}
@media (prefers-reduced-motion: reduce) { .dock-pill { transition: none; } }

/* Hero ------------------------------------------------------------------- */

.hero { padding-block: 0.5rem clamp(4rem, 9vw, 7rem); }
.hero-grid { display: grid; gap: 2rem; }

.portrait { max-width: 26rem; }
.portrait-frame {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--radius); background: #e3e3df;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.hero-copy { display: flex; flex-direction: column; align-items: flex-start; }

.name {
  font-size: clamp(3.25rem, 12vw, 5.75rem);
  font-weight: 500; line-height: 0.98; letter-spacing: -0.055em;
}
.name .w { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.name .w > span { display: block; }

.role { margin-top: 1.75rem; font-size: 1.375rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.25; }
.intro { max-width: 30rem; margin-top: 0.75rem; color: var(--muted); font-size: 1.125rem; line-height: 1.5; }

.icon-row { display: flex; gap: 0.625rem; margin-top: 2rem; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.4s var(--ease);
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--ink); border-color: var(--ink); color: #fff; }
.icon-btn::after {
  content: attr(data-label);
  position: absolute; left: 50%; bottom: calc(100% + 0.5rem);
  padding: 0.3rem 0.65rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.8125rem; font-weight: 500; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 4px); pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s var(--ease);
}
.icon-btn:hover::after, .icon-btn:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .icon-btn::after { display: none; } }

@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 2rem; align-items: end; }
  .portrait { grid-column: 1 / span 5; max-width: none; }
  .hero-copy { grid-column: 7 / span 6; padding-bottom: 0.25rem; }
}

/* Sections --------------------------------------------------------------- */

.section { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.section-grid { display: grid; gap: 1.5rem; }
.label { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.5; }
.section-body { min-width: 0; }

@media (min-width: 56rem) {
  .section-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 2rem; }
  .label { grid-column: 1 / span 3; }
  .section-body { grid-column: 4 / -1; }
}

/* About */
.statement {
  max-width: 36em; font-size: clamp(1.5rem, 3vw, 2.125rem);
  font-weight: 450; line-height: 1.25; letter-spacing: -0.035em;
}
.statement span { color: var(--muted); }

.facts { display: grid; margin-top: clamp(2.5rem, 5vw, 3.5rem); border-top: 1px solid var(--line); }
.facts > div { display: grid; gap: 0.15rem; padding-block: 1rem; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.9375rem; }
.facts dd { font-weight: 500; }
@media (min-width: 40rem) {
  .facts > div { grid-template-columns: 10rem minmax(0, 1fr); gap: 1.5rem; }
}

.sub { margin-top: clamp(3rem, 6vw, 4.5rem); font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: 0.875rem; background: var(--bg);
  transition: background-color 0.4s ease, color 0.4s ease;
}

.roles { display: grid; gap: 1rem; margin-top: 1rem; }
.role-card { padding: 1.5rem; }
.role-card .tile { margin-bottom: 2.5rem; }
.role-card h4 { font-size: 1.375rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; }
.role-card p { margin-top: 0.5rem; color: var(--muted); }
@media (min-width: 40rem) { .roles { grid-template-columns: 1fr 1fr; } }

/* Work */
.project {
  display: grid; gap: 0.35rem; padding-block: 1.75rem;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line);
}
.project h3 { font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 500; line-height: 1.05; letter-spacing: -0.05em; }
.project p { color: var(--muted); }
@media (min-width: 40rem) {
  .project { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: baseline; gap: 2rem; }
}

/* Connect */
.note { max-width: 32rem; margin-bottom: 1.75rem; color: var(--muted); }
.profiles { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .profiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.profile {
  position: relative; display: grid; align-content: space-between; gap: 3.5rem;
  min-height: 12rem; padding: 1.25rem; text-decoration: none;
  grid-template-columns: 1fr auto; grid-template-areas: "tile go" "platform platform" "handle handle";
  row-gap: 0;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease), border-color 0.45s var(--ease), transform 0.5s var(--ease);
}
.profile .tile { grid-area: tile; }
.profile .go { grid-area: go; color: var(--muted); transition: transform 0.5s var(--ease), color 0.3s; }
.profile .platform { grid-area: platform; margin-top: 3.5rem; font-size: 1.375rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; }
.profile .handle { grid-area: handle; color: var(--muted); overflow-wrap: anywhere; transition: color 0.3s; }

.profile:hover, .profile:focus-visible { background: var(--ink); border-color: var(--ink); color: #fff; }
.profile:hover .tile, .profile:focus-visible .tile { background: #fff; color: var(--ink); }
.profile:hover .go, .profile:focus-visible .go { color: #fff; transform: translate(3px, -3px); }
.profile:hover .handle, .profile:focus-visible .handle { color: rgba(255, 255, 255, 0.7); }
.profile:focus-visible { outline-color: var(--accent); outline-offset: 3px; }

/* Footer ----------------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); padding-block: 2rem 7rem; font-size: 0.9375rem; }
.foot { display: grid; gap: 1rem; align-items: center; }
.foot-name { font-weight: 500; }
.foot-note { color: var(--muted); }
.to-top {
  display: inline-flex; align-items: center; gap: 0.5rem; justify-self: start;
  padding: 0.6rem 1rem 0.6rem 1.15rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-weight: 500; text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.to-top svg { transition: transform 0.4s var(--ease); }
.to-top:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.to-top:hover svg { transform: translateY(-2px); }
@media (min-width: 48rem) {
  .foot { grid-template-columns: 1fr 1fr auto; gap: 2rem; }
  .to-top { justify-self: end; }
}

/* Motion ----------------------------------------------------------------- */
/* Hidden states exist only when JS is running and motion is allowed. */

@media (prefers-reduced-motion: no-preference) {
  .js .dock { transform: translate(-50%, 160%); }
  .js.loaded .dock { transform: translateX(-50%); transition: transform 1s var(--ease) 1.1s; }

  .js .name .w > span { transform: translateY(105%); }
  .js.loaded .name .w > span { transform: none; transition: transform 1.1s var(--ease); }
  .js.loaded .name .w:nth-child(2) > span { transition-delay: 0.08s; }
  .js.loaded .name .w:nth-child(3) > span { transition-delay: 0.16s; }

  .js [data-hero] { opacity: 0; transform: translateY(14px); }
  .js.loaded [data-hero] {
    opacity: 1; transform: none;
    transition: opacity 0.9s ease var(--d, 0s), transform 1s var(--ease) var(--d, 0s);
  }

  .js .portrait-frame { opacity: 0; transform: scale(0.97); }
  .js .portrait-frame img { transform: scale(1.12); }
  .js.loaded .portrait-frame { opacity: 1; transform: none; transition: opacity 0.9s ease, transform 1.3s var(--ease); }
  .js.loaded .portrait-frame img { transform: none; transition: transform 1.8s var(--ease); }

  .js [data-reveal] { opacity: 0; transform: translateY(18px); }
  .js [data-reveal].is-in {
    opacity: 1; transform: none;
    transition: opacity 0.8s ease var(--d, 0s), transform 0.9s var(--ease) var(--d, 0s);
  }

  .profile:hover, .icon-btn:hover { transform: translateY(-3px); }
}
