/* ============================================================
   Talha Yaseen — Portfolio
   Implemented from the Portfolio.dc.html design prototype.
   ============================================================ */

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

html { scroll-behavior: smooth; }

/* ── Theme tokens ──────────────────────────────────────── */
:root {
  --bg: #0c0c0e;
  --fg: #ecebe6;
  --muted: #b9b8b0;
  --dim: #9b9a92;
  --faint: #6b6b72;
  --line: rgba(236, 235, 230, .12);
  --hair: rgba(236, 235, 230, .1);
  --card: #111114;
  --accent: #c9f24d;
  --ink: #0c0c0e;
  --stripeA: #16161a;
  --stripeB: #131316;
  --marquee: #1c1c20;
  --demo: #08080a;
  --shadow: rgba(0, 0, 0, .5);
}

:root[data-theme="light"] {
  --bg: #f3f2ec;
  --fg: #17171a;
  --muted: #4c4c49;
  --dim: #6d6d68;
  --faint: #9a9a94;
  --line: rgba(20, 20, 22, .14);
  --hair: rgba(20, 20, 22, .1);
  --card: #ffffff;
  --accent: #8fb500;
  --ink: #ffffff;
  --stripeA: #e6e5de;
  --stripeB: #eeede7;
  --marquee: #e0dfd6;
  --demo: #f6f5f0;
  --shadow: rgba(20, 20, 22, .18);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .5s ease, color .5s ease;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--ink); }

.accent { color: var(--accent); }

section[id] { scroll-margin-top: 84px; }

/* ── Animations ────────────────────────────────────────── */
@keyframes floatUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Elements only start hidden when JS confirmed it can reveal them
   (see the inline <head> guard that adds .reveal-ready). */
.reveal-ready .reveal { opacity: 0; }
.reveal-ready .reveal.in { animation: floatUp .9s cubic-bezier(.16, .84, .44, 1) forwards; }

/* ── Layout shell ──────────────────────────────────────── */
.page { position: relative; overflow-x: hidden; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(201, 242, 77, .10), transparent 60%),
    radial-gradient(900px 500px at 8% 108%, rgba(120, 140, 255, .08), transparent 60%);
}

/* ── Header ────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 64px);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -.02em;
  font-size: 17px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 34px);
}

.nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 34px);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav a { transition: color .25s ease; }
.nav a:hover { color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 8px 8px 8px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: .06em;
  transition: background .5s ease, color .5s ease, border-color .5s ease;
}
.theme-glyph {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px clamp(20px, 5vw, 64px) 80px;
  max-width: 1440px;
  margin: 0 auto;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 34px;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.eyebrow .sep { color: var(--faint); }

.hero-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(48px, 9vw, 148px);
  line-height: .92;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.hero-lede {
  margin-top: 34px;
  max-width: 620px;
  font-size: clamp(17px, 2.1vw, 24px);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.hero-actions {
  margin-top: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  padding: 15px 26px;
  border-radius: 100px;
  transition: transform .3s ease, background .3s ease, border-color .3s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.btn-primary:hover { color: var(--ink); transform: translateY(-2px); }
.btn-arrow { font-size: 17px; }
.btn-ghost {
  font-weight: 500;
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Marquee ───────────────────────────────────────────── */
.marquee {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding: 20px 0;
}
.marquee-track {
  display: flex;
  width: max-content;
  white-space: nowrap;
  animation: marquee 34s linear infinite;
  will-change: transform;
}
.marquee-text {
  font-family: 'Fraunces', serif;
  font-size: clamp(28px, 5vw, 56px);
  letter-spacing: -.02em;
  color: var(--marquee);
  display: inline-flex;
  align-items: center;
}

/* ── Section shared ────────────────────────────────────── */
.work, .about, .contact {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
}
.work {
  padding: clamp(80px, 12vw, 160px) clamp(20px, 5vw, 64px);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: clamp(40px, 6vw, 80px);
}
.section-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(34px, 6vw, 80px);
  letter-spacing: -.02em;
}
.section-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: .08em;
}

/* ── Work cards ────────────────────────────────────────── */
.work-list {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 28px);
}
.work-card {
  position: relative;
  border: 1px solid var(--hair);
  border-radius: 20px;
  overflow: hidden;
  background: var(--card);
  transition: transform .5s cubic-bezier(.16, .84, .44, 1), border-color .5s ease, box-shadow .5s ease;
}
/* .in is the reveal state; keep it composable with hover transforms */
.work-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 30px 70px -34px var(--shadow);
}

.demo {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  background: var(--demo);
}
.spotlight {
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201, 242, 77, .16), transparent 68%);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
  z-index: 0;
}
.work-card:hover .spotlight { opacity: 1; }

.demo-no {
  position: absolute;
  top: 18px; left: 20px;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--faint);
}
.demo-badge {
  position: absolute;
  top: 16px; right: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 6px 11px;
  border-radius: 100px;
}
.pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.demo-stage {
  position: relative;
  z-index: 1;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 30px;
}

/* Demo: task manager */
.task-widget {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.task-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
}
.task-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
}
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--demo);
  border: 1px solid var(--hair);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .25s ease;
}
.task:hover { border-color: var(--line); }
.checkbox {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ink);
  flex-shrink: 0;
  transition: background .25s ease, border-color .25s ease;
}
.task-label {
  font-size: 14px;
  color: var(--fg);
  transition: color .25s ease, text-decoration-color .25s ease;
}
.task[aria-pressed="true"] .checkbox {
  background: var(--accent);
  border-color: var(--accent);
}
.task[aria-pressed="true"] .checkbox::after { content: '✓'; }
.task[aria-pressed="true"] .task-label {
  color: var(--faint);
  text-decoration: line-through;
}

/* Demo: analytics bars */
.bars-widget {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.bars-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.bars-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
}
.bars-refresh {
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink);
  background: var(--accent);
  border: none;
  padding: 6px 12px;
  border-radius: 100px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 130px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(var(--accent), rgba(201, 242, 77, .4));
  height: 20%;
  transition: height .6s cubic-bezier(.16, .84, .44, 1);
}
.bar-day {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--faint);
}

/* Demo: media player */
.player-widget {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.player-top { display: flex; align-items: center; gap: 14px; }
.player-art {
  width: 54px; height: 54px;
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, var(--stripeA) 0 8px, var(--stripeB) 8px 16px);
  flex-shrink: 0;
}
.player-info { min-width: 0; }
.player-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-sub { font-size: 13px; color: var(--dim); }
.progress-track {
  height: 6px;
  border-radius: 100px;
  background: var(--demo);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 100px;
}
.progress-times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--faint);
}
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.player-skip { font-size: 18px; color: var(--dim); cursor: pointer; }
.player-play {
  cursor: pointer;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--ink);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Work card meta */
.work-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(22px, 3vw, 36px);
}
.work-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(26px, 4vw, 46px);
  letter-spacing: -.02em;
  line-height: 1;
}
.work-desc {
  margin-top: 12px;
  max-width: 520px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}
.case-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color .3s ease;
}
.case-link:hover { border-color: var(--accent); }
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 260px;
}
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

/* ── About ─────────────────────────────────────────────── */
.about {
  padding: clamp(80px, 12vw, 160px) clamp(20px, 5vw, 64px);
  display: grid;
  grid-template-columns: 0.9fr 2fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
}
.about-label {
  position: sticky;
  top: 120px;
}
.about-bio {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(26px, 3.6vw, 50px);
  line-height: 1.22;
  letter-spacing: -.01em;
  text-wrap: pretty;
}
.about-sign {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.sign-name {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: clamp(24px, 3vw, 34px);
  color: var(--accent);
}
.sign-rule { height: 1px; flex: 0 0 44px; background: var(--line); }
.sign-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--faint);
}
.about-block { margin-top: clamp(40px, 5vw, 70px); }
.block-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 18px;
}
.now-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.now-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 14px 16px;
}
.now-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  padding-top: 2px;
}
.now-text { font-size: 14px; color: var(--muted); line-height: 1.4; }
.stats-grid {
  margin-top: clamp(40px, 5vw, 70px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
}
.stat { border-top: 1px solid var(--line); padding-top: 16px; }
.stat-value {
  font-family: 'Fraunces', serif;
  font-size: clamp(30px, 4vw, 44px);
}
.stat-label {
  margin-top: 6px;
  font-size: 14px;
  color: var(--dim);
  line-height: 1.4;
}
.skills { display: flex; flex-wrap: wrap; gap: 10px; }
.skill {
  font-size: 15px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 9px 15px;
  border-radius: 100px;
  transition: border-color .3s ease, color .3s ease;
}
.skill:hover { border-color: var(--accent); color: var(--fg); }

/* ── Contact ───────────────────────────────────────────── */
.contact {
  padding: clamp(90px, 14vw, 200px) clamp(20px, 5vw, 64px);
  text-align: center;
}
.contact-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 26px;
}
.mailto {
  display: inline-block;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(38px, 8vw, 120px);
  line-height: 1;
  letter-spacing: -.03em;
  border-bottom: 2px solid transparent;
  transition: border-color .4s ease, color .4s ease;
}
.mailto:hover { color: var(--accent); border-color: var(--accent); }
.socials {
  margin-top: clamp(48px, 7vw, 96px);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: 100px;
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.social:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.social .arrow { opacity: .6; }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--hair);
  padding: 28px clamp(20px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--faint);
}
.site-footer a { transition: color .25s ease; }
.site-footer a:hover { color: var(--accent); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 820px) {
  .about {
    grid-template-columns: 1fr;
  }
  .about-label {
    position: static;
    top: auto;
  }
}

@media (max-width: 640px) {
  .work-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .tags {
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .nav { display: none; }
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; }
  .reveal.in { animation: none; }
  .marquee-track { animation: none; }
  .work-card,
  .bar,
  .btn,
  .theme-toggle { transition: none; }
}
