/* ============================================================
   Faisal Khan — Portfolio  ·  v3: light, multi-page
   Space Grotesk display · IBM Plex Sans/Mono · vermillion accent
   ============================================================ */

:root {
  --bg:       #f4f4f3;
  --surface:  #ffffff;
  --surface-2:#fbfbfa;
  --ink:      #16161c;
  --ink-2:    #565660;
  --ink-3:    #9a9aa4;
  --accent:   #e8431f;
  --accent-2: #ff7a3d;
  --grad:     linear-gradient(100deg, #ff5a2e 0%, #ff8f3d 100%);
  --line:     rgba(22, 22, 28, 0.10);
  --line-2:   rgba(22, 22, 28, 0.055);
  --shadow:   0 18px 50px -22px rgba(22, 22, 28, 0.26);
  --shadow-sm:0 8px 24px -14px rgba(22, 22, 28, 0.22);

  --display: "Space Grotesk", system-ui, sans-serif;
  --sans:    "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  --wrap: 1180px;
  --gut: clamp(20px, 5vw, 68px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.62;
  font-size: clamp(15px, 1.05vw, 17px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }

a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }
.accent { color: var(--accent); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; font-style: normal; padding-right: .06em; }
.page-title em { font-style: normal; }

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

.skip-link { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--accent); color: #fff; padding: 10px 16px; font: 500 13px var(--mono); }
.skip-link:focus { left: 12px; top: 12px; }

/* ============================================================ HEADER */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .35s, background .35s;
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }

.wordmark { font: 600 19px var(--display); letter-spacing: -.02em; color: var(--ink); }
.wordmark__dot { color: var(--accent); }

.nav { display: flex; gap: clamp(14px, 2.2vw, 34px); }
.nav a { font: 500 13px var(--mono); color: var(--ink-2); position: relative; padding: 6px 0; transition: color .25s; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); border-radius: 2px; transition: width .3s var(--ease); }
.nav a:hover::after { width: 100%; }
.nav a[aria-current="page"]::after { width: 100%; }

.header-aside { display: flex; align-items: center; gap: 16px; }
.header-cta { font: 500 12.5px var(--mono); color: var(--ink); border: 1px solid var(--line); padding: 9px 16px; border-radius: 100px; background: var(--surface); transition: all .25s var(--ease); }
.header-cta:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.menu-toggle { display: none; background: none; border: 0; cursor: pointer; width: 32px; height: 32px; position: relative; }
.menu-toggle span { position: absolute; left: 5px; right: 5px; height: 1.8px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.menu-toggle span:nth-child(1) { top: 12px; } .menu-toggle span:nth-child(2) { bottom: 12px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

/* ============================================================ HERO (home) */
.hero { position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -10% -10% auto -10%; height: 75%; z-index: 0;
  background: radial-gradient(60% 100% at 75% 0%, rgba(255,122,61,0.16), transparent 70%),
              radial-gradient(50% 90% at 10% 10%, rgba(232,67,31,0.10), transparent 70%); pointer-events: none; }
.hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr .85fr; gap: clamp(32px, 6vw, 80px); align-items: center;
  padding-top: clamp(56px, 9vh, 110px); padding-bottom: clamp(48px, 8vh, 96px); }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 500 12.5px var(--mono); color: var(--ink-2); letter-spacing: .02em;
  border: 1px solid var(--line); background: var(--surface); padding: 8px 16px; border-radius: 100px; margin-bottom: clamp(22px, 4vh, 36px); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(232,67,31,.45); animation: pulse 2.3s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(232,67,31,.45);} 70%{box-shadow:0 0 0 9px rgba(232,67,31,0);} 100%{box-shadow:0 0 0 0 rgba(232,67,31,0);} }

.hero__title { font-family: var(--display); font-weight: 600; font-size: clamp(2.5rem, 6.4vw, 5.2rem); line-height: 1.0; letter-spacing: -.035em; max-width: 16ch; }
.hero__title span { display: block; }
.hero__title em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero__lede { margin-top: 26px; color: var(--ink-2); max-width: 42ch; font-size: clamp(15px, 1.15vw, 17px); }
.hero__cta { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }

.hero__portrait { position: relative; }
.hero__portrait .frame { position: relative; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.hero__portrait img { width: 100%; height: auto; display: block; aspect-ratio: 1; object-fit: cover; }
.hero__portrait::after { content: ""; position: absolute; inset: auto -18px -18px auto; width: 70%; height: 70%; border-radius: 24px; background: var(--grad); z-index: -1; opacity: .9; filter: blur(2px); }
.hero__badge { position: absolute; left: -14px; bottom: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 14px; padding: 12px 16px; font: 500 12.5px var(--mono); }
.hero__badge-logo { height: 21px; width: auto; display: block; margin-bottom: 8px; }
.hero__badge span { color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; gap: 7px; font: 500 13px var(--mono); padding: 13px 22px; border-radius: 100px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); transition: transform .25s var(--ease), border-color .25s, color .25s, box-shadow .25s; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn--solid { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 14px 30px -12px rgba(232,67,31,.55); }
.btn--solid:hover { box-shadow: 0 18px 40px -12px rgba(232,67,31,.7); }
.btn:not(.btn--solid):hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================ MARQUEE */
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 18px 0; background: var(--surface); }
.marquee__track { display: flex; align-items: center; gap: 30px; width: max-content; animation: scroll 42s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee span { font: 600 clamp(15px, 2.3vw, 22px) var(--display); color: var(--ink); white-space: nowrap; letter-spacing: -.01em; }
.marquee i { font-style: normal; color: var(--accent); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ============================================================ PAGE HEADER (inner pages) */
.page-header { padding-top: clamp(48px, 8vh, 92px); padding-bottom: clamp(28px, 4vh, 44px); position: relative; overflow: hidden; }
.page-header::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 50%; height: 120%; background: radial-gradient(50% 60% at 80% 20%, rgba(255,122,61,.14), transparent 70%); pointer-events: none; }
.page-header .eyebrow { margin-bottom: 20px; }
.page-title { font-family: var(--display); font-weight: 600; letter-spacing: -.035em; line-height: 1.02; font-size: clamp(2.2rem, 5.6vw, 4.2rem); max-width: 18ch; position: relative; }
.page-lede { margin-top: 22px; color: var(--ink-2); max-width: 58ch; font-size: clamp(15px, 1.1vw, 17px); position: relative; }

/* ============================================================ SECTION */
.section { padding-block: clamp(40px, 7vh, 90px); }
.section--tight { padding-top: clamp(20px, 3vh, 40px); }
.sub-h { font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -.025em; margin-bottom: clamp(24px, 4vh, 40px); }
.sub-h .num { font: 500 13px var(--mono); color: var(--accent); margin-right: 12px; vertical-align: middle; }

/* ============================================================ DIAGRAM */
.diagram { background: var(--ink); border-radius: 18px; padding: clamp(22px, 3vw, 44px); position: relative; overflow: hidden; margin-bottom: clamp(36px, 5vh, 60px); box-shadow: var(--shadow); }
.diagram__tag { position: absolute; top: 18px; right: 18px; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #c7c2b8; border: 1px solid rgba(255,255,255,.2); padding: 6px 12px; border-radius: 100px; }
.arch { width: 100%; height: auto; display: block; }
.arch .node rect { fill: rgba(255,255,255,.04); stroke: rgba(255,255,255,.3); stroke-width: 1.2; }
.arch .node__t { fill: #fff; font: 600 15px var(--sans); text-anchor: middle; }
.arch .node__s { fill: #b3aea4; font: 500 11px var(--mono); text-anchor: middle; }
.arch .node--accent rect { fill: rgba(232,67,31,.22); stroke: var(--accent-2); }
.arch .node--accent .node__s { fill: #ffc1a8; }
.arch .node--queue rect { stroke-dasharray: 4 3; }
.arch .node--store rect { fill: rgba(255,255,255,.02); stroke: rgba(255,255,255,.18); }
.arch__head path { fill: var(--accent-2); }
.arch__flow line { stroke: var(--accent-2); stroke-width: 2.2; stroke-dasharray: 7 6; filter: drop-shadow(0 0 4px rgba(255,122,61,.6)); animation: dash 1.05s linear infinite; }
.arch__link path { fill: none; stroke: rgba(255,255,255,.28); stroke-width: 1.3; stroke-dasharray: 4 5; animation: dash 1.6s linear infinite; }
.arch__link--state path { stroke: rgba(255,255,255,.16); }
@keyframes dash { to { stroke-dashoffset: -26; } }
.diagram__cap { margin-top: 18px; font: 500 12px var(--mono); color: #b3aea4; text-align: center; }

/* ============================================================ CASES */
.cases { list-style: none; display: grid; gap: 14px; }
.case { display: grid; grid-template-columns: 54px 1fr auto; gap: clamp(14px, 3vw, 44px); align-items: start; padding: clamp(22px, 3vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); position: relative; overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; }
.case::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); transform: scaleY(0); transform-origin: top; transition: transform .4s var(--ease); }
.case:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.case:hover::before { transform: scaleY(1); }
.case__num { font: 600 16px var(--mono); color: var(--accent); padding-top: 3px; }
.case__body h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.2rem, 2.2vw, 1.6rem); letter-spacing: -.02em; }
.case__body p { color: var(--ink-2); margin-top: 9px; max-width: 56ch; }
.case__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; max-width: 230px; padding-top: 4px; }
.case__tags li { font: 500 11px var(--mono); color: var(--ink-2); border: 1px solid var(--line); border-radius: 100px; padding: 5px 11px; white-space: nowrap; }

/* ============================================================ ABOUT */
.about__grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: start; }
.about__lead { font-family: var(--display); font-weight: 600; font-size: clamp(1.5rem, 3vw, 2.3rem); letter-spacing: -.025em; line-height: 1.12; margin-bottom: 28px; }
.about__lead em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.about__text p { color: var(--ink-2); margin-bottom: 18px; max-width: 58ch; }
.about__facts { margin-top: 30px; border-top: 1px solid var(--line); }
.about__facts > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.about__facts dt { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding-top: 2px; }
.about__facts dd { color: var(--ink); font-size: 14.5px; }
.about__portrait { position: sticky; top: 100px; }
.portrait { position: relative; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.portrait img { width: 100%; height: auto; display: block; aspect-ratio: 1; object-fit: cover; transition: transform .6s var(--ease); }
.about__portrait:hover .portrait img { transform: scale(1.03); }
.portrait__cap { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font: 500 11.5px var(--mono); color: var(--ink-3); }
.portrait__cap span:first-child { color: var(--ink); }

/* ============================================================ TIMELINE */
.timeline { list-style: none; display: grid; gap: 14px; }
.tl { display: grid; grid-template-columns: 190px 1fr; gap: clamp(16px, 4vw, 52px); padding: clamp(24px, 3.4vw, 34px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: transform .3s var(--ease), box-shadow .3s; }
.tl:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }
.tl__when { display: flex; flex-direction: column; gap: 7px; }
.tl__years { font: 600 16px var(--mono); color: var(--ink); letter-spacing: -.01em; }
.tl__type { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.tl__what h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.2rem, 2vw, 1.5rem); letter-spacing: -.02em; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.tl__org { font: 500 12px var(--mono); color: #fff; background: var(--grad); padding: 4px 10px; border-radius: 100px; }
.tl__what p { color: var(--ink-2); margin-top: 12px; max-width: 64ch; }

/* ============================================================ SKILLS */
.skills__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.skillset { padding: clamp(22px, 2.6vw, 30px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: transform .3s var(--ease), box-shadow .3s; }
.skillset:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.skillset h3 { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 16px; }
.skillset ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.skillset li { font-size: 15px; color: var(--ink); padding-left: 16px; position: relative; }
.skillset li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .65; }

/* ============================================================ HIGHLIGHTS (home) */
.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hl { padding: clamp(24px, 2.6vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: transform .3s var(--ease), box-shadow .3s; }
.hl:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.hl__k { font: 500 12px var(--mono); color: var(--accent); letter-spacing: .04em; }
.hl h3 { font-family: var(--display); font-weight: 600; font-size: 1.4rem; letter-spacing: -.02em; margin: 14px 0 8px; }
.hl p { color: var(--ink-2); font-size: 14.5px; }

/* ============================================================ CTA BAND */
.cta-band { margin: clamp(40px,8vh,80px) auto; max-width: var(--wrap); }
.cta-card { background: var(--ink); color: #fff; border-radius: 22px; padding: clamp(34px, 5vw, 64px); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.cta-card::before { content: ""; position: absolute; inset: auto auto -40% -10%; width: 60%; height: 120%; background: radial-gradient(50% 60% at 30% 80%, rgba(232,67,31,.4), transparent 70%); pointer-events: none; }
.cta-card h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.03em; line-height: 1.04; position: relative; }
.cta-card h2 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cta-card p { color: #c7c2b8; margin-top: 14px; max-width: 44ch; position: relative; }
.cta-card .hero__cta { margin-top: 28px; position: relative; }
.cta-card .btn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.2); color: #fff; }
.cta-card .btn:hover { border-color: #fff; color: #fff; }
.cta-card .btn--solid { background: var(--grad); border-color: transparent; }

/* ============================================================ CONTACT */
.contact__rows { border-top: 1px solid var(--line); margin-top: clamp(28px,4vh,44px); }
.crow { display: flex; align-items: center; gap: 20px; padding: clamp(18px, 2.4vw, 26px) 0; border-bottom: 1px solid var(--line); position: relative; transition: padding-left .35s var(--ease); }
.crow::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--grad); transition: width .4s var(--ease); }
a.crow:hover { padding-left: 16px; } .crow:hover::after { width: 100%; }
.crow__k { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); min-width: 96px; }
.crow__v { font-family: var(--display); font-weight: 500; font-size: clamp(1.15rem, 2.4vw, 1.85rem); letter-spacing: -.02em; color: var(--ink); flex: 1; }
a.crow:hover .crow__v { color: var(--accent); }
.crow__go { font: 400 1.3rem var(--sans); color: var(--ink-3); transition: transform .3s var(--ease), color .3s; }
a.crow:hover .crow__go { color: var(--accent); transform: translate(3px, -3px); }
.copy { font: 500 11.5px var(--mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 100px; padding: 7px 15px; cursor: pointer; transition: all .25s; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.copy.is-done { background: var(--grad); border-color: transparent; color: #fff; }

/* ============================================================ FOOTER */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-3); padding-block: 28px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; font: 500 12px var(--mono); }
.colophon strong { color: var(--ink); }
.to-top { color: var(--ink-3); transition: color .25s; }
.to-top:hover { color: var(--accent); }

/* ============================================================ REVEAL */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease) var(--d, 0s), transform .8s var(--ease) var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } .marquee__track, .dot, .arch__flow line, .arch__link path { animation: none; } }

/* ============================================================ RESPONSIVE */
@media (max-width: 880px) {
  .nav { position: fixed; inset: 72px 0 auto 0; flex-direction: column; gap: 0; background: rgba(244,244,243,.97); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding: 8px var(--gut) 22px; transform: translateY(-130%); transition: transform .4s var(--ease); z-index: 90; }
  .nav.is-open { transform: translateY(0); }
  .nav a { padding: 15px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
  .nav a::after { display: none; }
  .menu-toggle { display: block; }
  .header-cta { display: none; }
  .hero__inner { grid-template-columns: 1fr; gap: 36px; }
  .hero__portrait { max-width: 360px; }
  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { position: relative; top: 0; max-width: 340px; }
  .highlights { grid-template-columns: 1fr; }
  .skills__grid { grid-template-columns: repeat(2, 1fr); }
  .case { grid-template-columns: 40px 1fr; }
  .case__tags { grid-column: 2; justify-content: flex-start; max-width: none; margin-top: 8px; }
  .tl { grid-template-columns: 1fr; gap: 12px; }
  .tl__when { flex-direction: row; gap: 12px; align-items: baseline; }
}
@media (max-width: 540px) { .skills__grid { grid-template-columns: 1fr; } .crow__k { min-width: 64px; } .copy { display: none; } }
