/* ============================================================
   Mir Sayad Bin Almas — Portfolio
   Black on white. Editorial grotesk + serif italic accents.
   ============================================================ */

:root {
  --paper: #ffffff;
  --ink: #0e0e0e;
  --gray: #6f6f6f;
  --hairline: #e4e4e0;
  --hairline-dark: rgba(255, 255, 255, 0.22);
  --font-sans: "Archivo", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  --pad: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--paper); }
.contact ::selection, .case-dark ::selection, .menu-overlay ::selection {
  background: var(--paper);
  color: var(--ink);
}

/* Lenis drives the scroll; native smooth scrolling would fight it */
html.lenis { scroll-behavior: auto; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.serif-it {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

a { color: inherit; }

@media (pointer: fine) {
  body.custom-cursor, body.custom-cursor a, body.custom-cursor button { cursor: none; }
}

/* ---------- cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate(-100px, -100px);
  transition: width 0.3s var(--ease), height 0.3s var(--ease);
}
body.custom-cursor .cursor { opacity: 1; }
.cursor.big { width: 64px; height: 64px; }
.cursor.mid { width: 28px; height: 28px; }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--pad);
  height: 76px;
  background: rgba(255, 255, 255, 0);
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease, backdrop-filter 0.4s ease;
}
.nav.scrolled {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--hairline);
}
.nav-name {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.nav-name span { color: var(--gray); font-weight: 600; }
.nav-links {
  display: flex;
  gap: clamp(18px, 3vw, 44px);
}
.nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray);
  transition: color 0.25s ease;
  position: relative;
  display: inline-block;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: blinkDot 2.4s ease-in-out infinite;
}
@keyframes blinkDot { 50% { opacity: 0.25; } }
.status-time { color: var(--gray); }

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px; height: 44px;
  background: none;
  border: 0;
  padding: 8px;
}
.nav-burger span {
  display: block;
  height: 2px;
  background: var(--ink);
  transition: transform 0.35s var(--ease);
}
.nav-burger.open span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

/* ---------- mobile menu overlay ---------- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 48px;
  padding: 0 var(--pad);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.6s var(--ease);
}
.menu-overlay.open { clip-path: inset(0 0 0% 0); }
.menu-links { display: flex; flex-direction: column; gap: 6px; }
.menu-links a {
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.menu-links a em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.9rem;
  vertical-align: super;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 10px;
}
.menu-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.menu-foot a { text-decoration: none; color: rgba(255, 255, 255, 0.7); }

/* nav inverts while the overlay is open */
body.menu-open .nav {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.menu-open .nav-name { color: var(--paper); }
body.menu-open .nav-name span { color: rgba(255, 255, 255, 0.5); }
body.menu-open .nav-burger span { background: var(--paper); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 100px var(--pad) 0;
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.hero > *:not(#hero-canvas) { position: relative; z-index: 1; }

.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--gray);
}
.hero-meta-right { text-align: right; }

.hero-title {
  font-size: clamp(2.6rem, 8vw, 7rem);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 0.94;
  letter-spacing: -0.03em;
  margin: clamp(28px, 6vh, 64px) 0 clamp(28px, 5vh, 56px);
}
.hero-title .serif-it {
  font-size: 0.92em;
  font-weight: 400;
}

/* line mask reveal (JS only) */
html.js .line { display: block; overflow: hidden; }
html.js .line-in {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1.1s var(--ease);
}
html.js body.loaded .line:nth-child(1) .line-in { transition-delay: 0.05s; transform: translateY(0); }
html.js body.loaded .line:nth-child(2) .line-in { transition-delay: 0.16s; transform: translateY(0); }
html.js body.loaded .line:nth-child(3) .line-in { transition-delay: 0.27s; transform: translateY(0); }

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: clamp(28px, 5vh, 56px);
}
.hero-desc {
  max-width: 44ch;
  color: var(--gray);
  font-size: clamp(0.98rem, 1.4vw, 1.12rem);
  line-height: 1.65;
}
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s var(--ease);
}
.btn span { transition: transform 0.3s var(--ease); }
.btn:hover span { transform: translate(2px, 2px); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn-line:hover span { transform: translateX(4px); }

.hero-stats {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 0 22px;
  border-top: 1px solid var(--hairline);
  color: var(--gray);
}
.hero-scroll { color: var(--ink); }

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
  padding: 18px 0;
}
.marquee-track {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: marquee 30s linear infinite;
}
.marquee-track span {
  font-size: clamp(1.3rem, 3.4vw, 2.6rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  padding-right: 0.5em;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- sections ---------- */
.section { padding: clamp(90px, 14vh, 170px) var(--pad) 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--gray);
  margin-bottom: clamp(40px, 7vh, 80px);
}
.section-head-dark { border-bottom-color: var(--hairline-dark); color: rgba(255,255,255,0.55); }

/* ---------- about ---------- */
.about-statement {
  font-size: clamp(1.6rem, 3.4vw, 2.9rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 24ch;
  margin-bottom: clamp(48px, 8vh, 96px);
}
.about-statement .serif-it { font-size: 0.95em; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.about-copy p {
  color: var(--gray);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.7;
  margin-bottom: 22px;
  max-width: 56ch;
}
.about-tools { border-top: 1px solid var(--hairline); }
.tool-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.tool-row .mono { color: var(--gray); padding-top: 3px; }
.tool-row p { font-weight: 600; font-size: 0.98rem; }

/* ---------- work ---------- */
.work-filters {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.filter {
  background: none;
  border: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray);
  padding: 4px 0;
  position: relative;
  transition: color 0.25s ease;
}
.filter sup {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  margin-left: 3px;
  color: var(--gray);
}
.filter::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.filter:hover { color: var(--ink); }
.filter.active { color: var(--ink); }
.filter.active::after { transform: scaleX(1); transform-origin: left; }

.work-list { border-top: 1px solid var(--hairline); }
.work-row { border-bottom: 1px solid var(--hairline); }
.work-row.hidden { display: none; }

.work-head {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr auto 44px;
  align-items: center;
  gap: clamp(14px, 3vw, 40px);
  width: 100%;
  padding: clamp(20px, 3.4vh, 34px) clamp(6px, 1vw, 16px);
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--font-sans);
  color: var(--ink);
  overflow: hidden;
}
.work-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s var(--ease);
  z-index: 0;
}
.work-head:hover::before,
.work-row.open .work-head::before { transform: scaleY(1); transform-origin: bottom; }
.work-head > * { position: relative; z-index: 1; transition: color 0.3s ease; }
.work-head:hover > *,
.work-row.open .work-head > * { color: var(--paper); }

.work-idx { color: var(--gray); }
.work-title {
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.work-tag { color: var(--gray); white-space: nowrap; }

.work-plus {
  position: relative;
  width: 18px; height: 18px;
  justify-self: end;
  transition: transform 0.4s var(--ease);
}
.work-plus::before, .work-plus::after {
  content: "";
  position: absolute;
  background: currentColor;
  transition: background 0.3s ease;
}
.work-plus::before { left: 0; right: 0; top: 8px; height: 2px; }
.work-plus::after { top: 0; bottom: 0; left: 8px; width: 2px; }
.work-row.open .work-plus { transform: rotate(45deg); }

.work-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease);
}
.work-row.open .work-body { grid-template-rows: 1fr; }
.work-body-in {
  min-height: 0;
  overflow: hidden;
}
.work-body-in p {
  max-width: 64ch;
  color: var(--gray);
  font-size: 1rem;
  line-height: 1.7;
  padding: 0 clamp(6px, 1vw, 16px);
}
.work-body-in p:first-child { padding-top: 4px; }
.work-body-in .work-stack {
  color: var(--ink);
  padding-top: 14px;
  padding-bottom: 30px;
  font-size: 0.72rem;
}
.work-body-in .work-link {
  display: inline-block;
  margin: -14px clamp(6px, 1vw, 16px) 30px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.work-body-in .work-link:hover { color: var(--gray); }

/* ---------- case studies ---------- */
.case {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  border: 1px solid var(--hairline);
  padding: clamp(28px, 4.5vw, 64px);
  margin-bottom: 28px;
}
.case-dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.case-tag { color: var(--gray); display: block; margin-bottom: 18px; }
.case-dark .case-tag { color: rgba(255, 255, 255, 0.5); }
.case-title {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: clamp(28px, 4vh, 44px);
  max-width: 22ch;
}
.case-title .serif-it { font-size: 0.95em; }
.case-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 3vw, 48px);
}
.case-cols h4 { color: var(--gray); margin-bottom: 12px; }
.case-dark .case-cols h4 { color: rgba(255, 255, 255, 0.5); }
.case-cols p, .case-cols li {
  color: var(--gray);
  font-size: 0.95rem;
  line-height: 1.7;
}
.case-dark .case-cols p, .case-dark .case-cols li { color: rgba(255, 255, 255, 0.72); }
.case-cols ul { list-style: none; }
.case-cols li {
  padding-left: 18px;
  position: relative;
  margin-bottom: 8px;
}
.case-cols li::before {
  content: "+";
  position: absolute;
  left: 0;
}
.case-metrics {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.case-metric {
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}
.case-metric:first-child { border-top: 1px solid var(--hairline); }
.case-dark .case-metric,
.case-dark .case-metric:first-child { border-color: var(--hairline-dark); }
.case-metric strong {
  display: block;
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.case-metric span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
}
.case-dark .case-metric span { color: rgba(255, 255, 255, 0.5); }

/* ---------- contact / footer ---------- */
.contact {
  background: var(--ink);
  color: var(--paper);
  margin-top: clamp(90px, 14vh, 170px);
  padding: clamp(70px, 10vh, 120px) var(--pad) 28px;
}
.contact-lead {
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 600;
  margin-bottom: clamp(20px, 4vh, 40px);
  color: rgba(255, 255, 255, 0.85);
}
.contact-mail {
  display: inline-block;
  font-size: clamp(1.4rem, 4.2vw, 3.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  line-height: 1.05;
  word-break: break-word;
  text-decoration: none;
  margin-bottom: clamp(36px, 7vh, 72px);
  position: relative;
}
.contact-mail::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%; height: 3px;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.contact-mail:hover::after { transform: scaleX(1); transform-origin: left; }
.contact-links {
  display: flex;
  gap: clamp(20px, 4vw, 48px);
  flex-wrap: wrap;
  margin-bottom: clamp(48px, 9vh, 100px);
}
.contact-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: color 0.25s ease;
  display: inline-block;
}
.contact-links a:hover { color: var(--paper); }
.contact-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--hairline-dark);
  color: rgba(255, 255, 255, 0.5);
}
.contact-bar button {
  background: none;
  border: 0;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-block;
}

/* ---------- reveal on scroll (JS only) ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
html.js .reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .nav-status { display: none; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
  .tool-row { grid-template-columns: 130px 1fr; }
  .case { grid-template-columns: 1fr; }
  .case-cols { grid-template-columns: 1fr; }
  .work-head { grid-template-columns: 40px 1fr 34px; }
  .work-tag { display: none; }
  .hero-meta span:nth-child(2) { display: none; }
}
@media (max-width: 560px) {
  .hero-stats { flex-direction: column; gap: 8px; }
  .hero-scroll { display: none; }
  .contact-mail { font-size: clamp(1.15rem, 6.4vw, 2rem); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.js .reveal, html.js .line-in { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
}
