/* ============================================================
   Keshav Sapra · pinned work portfolio
   Design system: Manrope (primary) + Geist Mono (data only)
   Dark flat surfaces, one text gradient, weighted motion.
   ============================================================ */

/* ---------- Fonts (self hosted, offline) ---------- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geistmono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geistmono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* surfaces (dark palette) */
  --bg: #000000;
  --surface1: #181818;
  --surface2: #272727;
  --surface3: #313131;
  --art-bg: #181818;
  --text: #FFFFFF;
  --muted: #9B9B9B;
  --accent: #7EE0B8;
  --line: rgba(255, 255, 255, 0.08);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 700ms;

  /* type */
  --font: "Manrope", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-padding-top: 112px; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, .contact-title, .tagline-copy { text-wrap: balance; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 24px;
}
@media (max-width: 640px) {
  .container { padding-inline: 16px; }
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: #000;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

/* ============================================================
   Sub nav
   ============================================================ */
.nav-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding-top: 16px;
  pointer-events: none;
}
.nav {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 8px 12px;
  background: rgba(24, 24, 24, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  text-decoration: none;
  font-weight: 600;
}
.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--accent);
}
.brand-name { font-size: 14px; }
.nav-links { display: inline-flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 300ms var(--ease), background-color 300ms var(--ease);
}
.nav-link:hover, .nav-link:focus-visible { color: var(--text); background: var(--surface2); }
.nav-link-ext { color: var(--text); background: var(--surface2); }
.nav-link-ext:hover, .nav-link-ext:focus-visible { background: var(--surface3); }
.nav-toggle { display: none; position: relative; z-index: 60; width: 40px; height: 40px; border-radius: 8px; }
.nav-toggle-line {
  position: absolute;
  left: 10px;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 500ms var(--ease);
}
.nav-toggle-line:nth-child(1) { top: 15px; }
.nav-toggle-line:nth-child(2) { top: 23px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav { width: calc(100% - 32px); justify-content: space-between; }
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 55;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    padding: 48px 32px;
    background: rgba(0, 0, 0, 0.92);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 500ms var(--ease), visibility 0s linear 500ms;
  }
  .nav-links.open { opacity: 1; visibility: visible; transition: opacity 500ms var(--ease); }
  .nav-links .nav-link {
    font-size: 36px;
    line-height: 40px;
    padding: 8px 0;
    transform: translateY(24px);
    opacity: 0;
    transition: transform 500ms var(--ease), opacity 500ms var(--ease), color 300ms var(--ease), background-color 300ms var(--ease);
  }
  .nav-links.open .nav-link {
    transform: translateY(0);
    opacity: 1;
    transition-delay: calc(var(--i) * 60ms);
  }
  body.menu-open { overflow: hidden; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: 176px 0 96px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 32px;
}
.hero-title {
  font-size: 60px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 680px;
  background: linear-gradient(90deg, #FFFFFF 30%, #9B9B9B 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 32px;
}
.hero-sub {
  font-size: 18px;
  line-height: 28px;
  color: var(--muted);
  max-width: 680px;
  margin-bottom: 40px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 80px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 300ms var(--ease), color 300ms var(--ease), transform 500ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--text); color: #000; padding: 8px 12px; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--accent); color: #000; }
.btn-ghost { border: 1px solid rgba(255,255,255,0.16); padding: 8px 12px; color: var(--text); }
.btn-ghost:hover, .btn-ghost:focus-visible { background: var(--surface1); border-color: rgba(255,255,255,0.28); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 48px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.hero-stats li { display: flex; flex-direction: column; gap: 4px; }
.stat-num {
  font-family: var(--mono);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
}
.stat-label {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}
@media (max-width: 820px) { .hero-title { font-size: 48px; } }
@media (max-width: 640px) {
  .hero { padding: 128px 0 64px; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: 24px; }
}

/* ============================================================
   Tagline reveal (word by word)
   ============================================================ */
.tagline { padding: 96px 0; }
.tagline-copy {
  font-size: 48px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 680px;
}
.tagline .w {
  display: inline-block;
  color: rgba(255, 255, 255, 0.28);
  transition: color 500ms var(--ease);
}
.tagline .w.in { color: var(--text); transition-delay: calc(80ms + var(--i) * 40ms); }
@media (max-width: 820px) { .tagline-copy { font-size: 36px; line-height: 40px; } }

/* ============================================================
   Sections
   ============================================================ */
.work { padding: 96px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
}
.section-title { font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -0.01em; }
.section-note {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Project cards ---------- */
.work .container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: stretch;
}
.work .section-head { grid-column: 1 / -1; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface1);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 300ms var(--ease), transform 700ms var(--ease);
}
.card:hover, .card:focus-within { border-color: rgba(255,255,255,0.22); transform: translateY(-4px); }
.card-wide { grid-column: 1 / -1; flex-direction: row; }
.card-wide .card-art { flex: 1 1 50%; min-height: 320px; }
.card-wide .card-body { flex: 1 1 50%; }

.card-art { aspect-ratio: 44 / 26; background: var(--art-bg); border-bottom: 1px solid var(--line); overflow: hidden; }
.card-wide .card-art { aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); }
.card-art svg {
  width: 100%;
  height: 100%;
  transform: scale(1.001);
  transition: transform 900ms var(--ease);
}
.card:hover .card-art svg, .card:focus-within .card-art svg { transform: scale(1.04); }

.card-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; flex: 1; }
.card-wide .card-body { padding: 40px; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-index {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}
.card-flag {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--accent);
  color: #000;
}
.card-flag-muted { background: var(--surface2); color: var(--muted); }
.card-title { font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.01em; }
.card-desc { font-size: 16px; line-height: 24px; color: var(--muted); max-width: 560px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.card-tags li {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 8px;
  border-radius: 8px;
}
.card-meta {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 16px;
}
.card-links { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 4px; }
.card-link {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-link span { transition: transform 700ms var(--ease); }
.card-link:hover, .card-link:focus-visible { color: var(--accent); }
.card-link:hover span, .card-link:focus-visible span { transform: translate(2px, -2px); }
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card-link-alt { position: relative; z-index: 2; color: var(--accent); }
.card-link-alt::after { content: none; }

/* ---------- Stack ---------- */
.stack { background: var(--surface1); padding: 80px 0; }
.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.stack-item {
  background: #1F1F1F;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stack-lang { font-size: 24px; line-height: 32px; font-weight: 600; }
.stack-use { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }

.steps {
  margin-top: 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}
.step { border-top: 1px solid var(--line); padding-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.step-num { font-family: var(--mono); font-size: 14px; line-height: 20px; color: var(--accent); }
.step-title { font-size: 24px; line-height: 32px; font-weight: 600; }
.step p { font-size: 16px; line-height: 24px; color: var(--muted); }

@media (max-width: 920px) {
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 820px) {
  .work { grid-template-columns: 1fr; }
  .card-wide { flex-direction: column; }
  .card-wide .card-art { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; aspect-ratio: 44 / 26; }
  .card-wide .card-body { padding: 24px; }
}

/* ---------- Contact ---------- */
.contact { padding: 96px 0 128px; text-align: center; }
.contact-title {
  font-size: 48px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 680px;
  margin: 0 auto 24px;
}
.contact-sub {
  font-size: 18px;
  line-height: 28px;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 48px;
}
.contact .hero-cta { justify-content: center; margin-bottom: 0; }
@media (max-width: 640px) { .contact-title { font-size: 36px; line-height: 40px; } }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
}
.footer-brand { font-weight: 600; font-size: 16px; }
.footer-note {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}
.footer-copy { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }

/* ---------- 404 ---------- */
.notfound {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  max-width: 1200px;
  margin-inline: auto;
  padding: 96px 24px;
}
.nf-title {
  font-size: 48px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.nf-sub {
  font-size: 18px;
  line-height: 28px;
  color: var(--muted);
  margin-bottom: 48px;
}
@media (max-width: 640px) { .nf-title { font-size: 36px; line-height: 40px; } }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { transform: none; transition: opacity 300ms linear; }
  .card, .card-art svg, .btn, .nav-toggle-line, .card-link span { transition: none; }
  .tagline .w { color: var(--text); transition: none; }
}
