/* ============================================================
   RAYYAN KHAN — PORTFOLIO
   Warm paper · ink · one signal-orange accent. Editorial, calm.
   ============================================================ */
:root {
  --paper: #FAF8F3;
  --paper-2: #F2EEE5;
  --card: #FFFFFF;
  --ink: #171410;
  --muted: #6F675B;
  --line: rgba(23, 20, 16, 0.14);
  --accent: #FF4D00;
  --accent-soft: rgba(255, 77, 0, 0.08);
  --radius: 18px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

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

::selection { background: var(--accent); color: #fff; }

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.container { width: min(1200px, 92vw); margin: 0 auto; }

/* film grain */
.grain {
  position: fixed; inset: -50%; width: 200%; height: 200%;
  pointer-events: none; z-index: 200; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 10% { transform: translate(-2%,-3%); }
  30% { transform: translate(3%,-2%); } 50% { transform: translate(-3%,2%); }
  70% { transform: translate(2%,3%); } 90% { transform: translate(-1%,1%); }
}

.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; }

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px min(4vw, 48px);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), padding 0.4s var(--ease);
}
.nav.scrolled {
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
  padding-top: 12px; padding-bottom: 12px;
}
.nav-brand { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 50%; font-size: 13px; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1.5px; width: 100%;
  background: var(--accent); 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-cta {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.04em;
  border: 1px solid var(--line); border-radius: 100px; padding: 9px 18px;
  background: rgba(255,255,255,0.6); transition: border-color 0.3s, background 0.3s;
}
.nav-cta:hover { border-color: var(--ink); background: #fff; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid #22a06b; opacity: 0.6; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }

/* ============ HERO ============ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  padding: 130px 0 90px; overflow: hidden;
}
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-video { width: 100%; height: 100%; object-fit: cover; opacity: 0.42; }
.hero-fade {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 70% 20%, transparent 30%, var(--paper) 78%),
    linear-gradient(to bottom, rgba(250,248,243,0.55), rgba(250,248,243,0.15) 40%, var(--paper) 96%);
}
.hero-canvas { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.hero-inner { position: relative; z-index: 2; width: min(1200px, 92vw); margin: 0 auto; }

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 100px;
  padding: 9px 18px; background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  margin-bottom: 34px;
}
.kicker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.hero-title {
  font-size: clamp(64px, 13vw, 178px);
  line-height: 0.94; letter-spacing: -0.035em; font-weight: 700;
  text-transform: uppercase; margin-bottom: 30px;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: inline-block; }
.hero-title .serif { color: var(--accent); }

.hero-sub {
  font-size: clamp(18px, 2.4vw, 24px); line-height: 1.5;
  max-width: 620px; color: #3A352C; margin-bottom: 40px; font-weight: 500;
}
.hero-sub .serif { font-size: 1.12em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 64px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 16px; border-radius: 100px; padding: 16px 30px;
  transition: transform 0.3s var(--ease), background 0.3s, color 0.3s, border-color 0.3s;
  will-change: transform;
}
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); }
.btn-ghost { border: 1.5px solid var(--line); background: rgba(255,255,255,0.5); }
.btn-ghost:hover { border-color: var(--ink); background: #fff; }
.btn-big { font-size: 19px; padding: 20px 42px; }
.arrow { display: inline-block; transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateY(3px); }

.scroll-hint {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 26px; height: 44px; border: 1.5px solid var(--muted); border-radius: 20px;
  display: flex; justify-content: center; padding-top: 9px; opacity: 0.7;
}
.scroll-hint span { width: 4px; height: 9px; border-radius: 4px; background: var(--accent); animation: hint 1.8s var(--ease) infinite; }
@keyframes hint { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ============ MARQUEE ============ */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--ink); color: var(--paper); overflow: hidden; padding: 20px 0;
  transform: rotate(-1.2deg) scale(1.02); margin: 10px 0 0;
}
.marquee-track { display: flex; align-items: center; gap: 34px; width: max-content; animation: marquee 30s linear infinite; }
.marquee-track span { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.marquee-track i { color: var(--accent); font-style: normal; font-size: 18px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ SECTIONS ============ */
.section { padding: clamp(90px, 11vw, 150px) 0; position: relative; }
.section-kicker {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 26px;
  display: flex; align-items: center; gap: 14px;
}
.section-kicker::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.section-title {
  font-size: clamp(38px, 5.6vw, 72px); line-height: 1.04;
  letter-spacing: -0.03em; font-weight: 700; margin-bottom: 22px;
}
.section-title .serif { font-weight: 400; }
.section-note { color: var(--muted); max-width: 520px; font-size: 17px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; } .reveal[data-delay="2"] { transition-delay: 0.16s; }

/* ============ ABOUT ============ */
.about-grid { display: grid; grid-template-columns: 380px 1fr; gap: clamp(40px, 6vw, 90px); align-items: start; margin-top: 54px; }
.photo-frame {
  border-radius: 200px 200px var(--radius) var(--radius);
  overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px rgba(23,20,16,0.25);
  aspect-ratio: 4 / 5; background: var(--paper-2);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 1.2s var(--ease); }
.photo-frame:hover img { transform: scale(1.07); }
.photo-caption { margin-top: 14px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-align: center; }
.about-copy p { margin-bottom: 20px; font-size: 18px; line-height: 1.7; color: #35301F; max-width: 640px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 40px; border-top: 1px solid var(--line); padding-top: 30px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: clamp(30px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-num::after { content: ""; }
.stat-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ============ WORK ============ */
.work { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.work-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 20px; flex-wrap: wrap; }
.work-list { margin-top: 44px; border-top: 1px solid var(--line); }
.work-row {
  display: grid; grid-template-columns: 70px 1fr 60px; gap: 26px; align-items: start;
  padding: 34px 10px; border-bottom: 1px solid var(--line);
  position: relative; transition: background 0.4s var(--ease), padding 0.4s var(--ease);
}
a.work-row:hover { background: rgba(255,255,255,0.65); padding-left: 22px; }
.work-index { font-family: var(--font-mono); font-size: 14px; color: var(--muted); padding-top: 8px; transition: color 0.3s; }
a.work-row:hover .work-index { color: var(--accent); }
.work-title { font-size: clamp(22px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; display: block; margin-bottom: 10px; }
.work-title .wip {
  font-family: var(--font-mono); font-style: normal; font-size: 11px; letter-spacing: 0.1em;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(255,77,0,0.3);
  padding: 4px 10px; border-radius: 100px; vertical-align: middle; margin-left: 10px;
}
.work-desc { color: #454034; font-size: 16px; line-height: 1.65; max-width: 720px; display: block; margin-bottom: 14px; }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.work-tags i {
  font-style: normal; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em;
  border: 1px solid var(--line); border-radius: 100px; padding: 5px 12px; color: var(--muted);
  background: rgba(255,255,255,0.5);
}
.work-arrow { font-size: 26px; justify-self: end; transition: transform 0.35s var(--ease), color 0.3s; padding-top: 4px; }
a.work-row:hover .work-arrow { transform: translate(6px, -6px); color: var(--accent); }
.work-arrow-static { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* ============ EXPERIENCE ============ */
.timeline { margin-top: 54px; border-top: 1px solid var(--line); }
.tl-row { display: grid; grid-template-columns: 220px 1fr; gap: 34px; padding: 36px 0; border-bottom: 1px solid var(--line); }
.tl-when { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.06em; color: var(--muted); padding-top: 6px; }
.tl-what h3 { font-size: clamp(21px, 2.6vw, 28px); letter-spacing: -0.02em; margin-bottom: 10px; }
.tl-what h3 span { color: var(--muted); font-weight: 500; }
.tl-what p { color: #454034; max-width: 700px; font-size: 16.5px; }

/* ============ LEARNING ============ */
.learning { background: var(--ink); color: var(--paper); overflow: hidden; }
.learning .section-kicker { color: rgba(250,248,243,0.55); }
.learning .section-kicker::after { background: rgba(250,248,243,0.16); }
.learning .section-title .serif { color: var(--accent); }
.learning .section-note { color: rgba(250,248,243,0.62); }
.learning-canvas { position: absolute; top: 60px; right: -40px; width: 420px; height: 420px; opacity: 0.9; pointer-events: none; }
.roadmap { list-style: none; margin: 50px 0 60px; border-top: 1px solid rgba(250,248,243,0.14); counter-reset: rm; }
.roadmap li {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 20px; align-items: center;
  padding: 20px 6px; border-bottom: 1px solid rgba(250,248,243,0.14);
  transition: background 0.3s, padding 0.3s;
}
.roadmap li:hover { background: rgba(255,255,255,0.04); padding-left: 16px; }
.rm-index { font-family: var(--font-mono); font-size: 13px; color: rgba(250,248,243,0.45); }
.rm-name { font-size: clamp(18px, 2.4vw, 24px); font-weight: 600; letter-spacing: -0.015em; }
.rm-state {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(250,248,243,0.42); white-space: nowrap;
}
.rm-state.done::before { content: "\2713  "; color: #7fc8a9; }
.rm-state.active { color: var(--accent); display: inline-flex; align-items: center; gap: 9px; }
.rm-state.active::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: statePulse 2.4s ease-in-out infinite;
}
@keyframes statePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,77,0,0.5); } 50% { box-shadow: 0 0 0 8px rgba(255,77,0,0); } }
.stacks { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.stack-col { border: 1px solid rgba(250,248,243,0.16); border-radius: var(--radius); padding: 30px; background: rgba(255,255,255,0.03); }
.stack-col h4 { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.stack-col p { color: rgba(250,248,243,0.78); font-size: 16px; line-height: 1.8; }

/* ============ CREDS ============ */
.creds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; }
.cred {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px;
  background: var(--card); transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.cred:hover { transform: translateY(-4px); box-shadow: 0 24px 44px -24px rgba(23,20,16,0.22); }
.cred-name { font-weight: 600; font-size: 16.5px; letter-spacing: -0.01em; }

/* ============ FAQ ============ */
.faq-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--card); }
.faq-item h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }
.faq-item p { color: var(--muted); font-size: 15.5px; line-height: 1.75; }
@media (max-width: 760px) { .faq-list { grid-template-columns: 1fr; } }

/* ============ CONTACT ============ */
.contact { text-align: left; }
.contact-title { font-size: clamp(44px, 7.5vw, 104px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; margin: 10px 0 44px; }
.contact-title .serif { color: var(--accent); }
.contact-actions { margin-bottom: 34px; }
.socials { display: flex; gap: 26px; flex-wrap: wrap; }
.socials a { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; transition: color 0.3s, border-color 0.3s; }
.socials a:hover { color: var(--ink); border-color: var(--accent); }
.socials a span { color: var(--accent); }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--line); padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); letter-spacing: 0.04em; }
.footer-inner a:hover { color: var(--accent); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 340px; }
  .stacks { grid-template-columns: 1fr; }
  .creds-grid { grid-template-columns: 1fr; }
  .learning-canvas { width: 260px; height: 260px; top: 40px; opacity: 0.55; }
  .tl-row { grid-template-columns: 1fr; gap: 8px; }
  .work-row { grid-template-columns: 44px 1fr 40px; gap: 14px; padding: 26px 4px; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding-top: 110px; }
  .hero-canvas { opacity: 0.55; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero-video { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track, .grain, .scroll-hint span, .pulse::after, .rm-state.active { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: smooth; }
}
