/* ============================================================
   Udit Khandelwal — uditk2.github.io
   Futuristic single-page brochure. Hand-coded, no frameworks.
   Palette: authentic monochrome — near-black + silver/white.
   ============================================================ */

:root {
  --bg: #070809;
  --bg-2: #0b0d0f;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-brd: rgba(255, 255, 255, 0.10);
  --panel-brd-hi: rgba(255, 255, 255, 0.28);
  --ink: #edeef1;
  --ink-dim: #9a9fa8;
  --ink-faint: #626770;
  --silver: #cfd4dc;         /* restrained light accent */
  --silver-soft: #aab0ba;
  --accent-grad: linear-gradient(120deg, #ffffff, #b7bcc6 60%, #8b909a);
  --radius: 18px;
  --maxw: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 70% -10%, #14171c 0%, transparent 60%),
              radial-gradient(1000px 700px at 0% 20%, #101216 0%, transparent 55%),
              var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(255, 255, 255, 0.18); color: #fff; }

a { color: inherit; text-decoration: none; }

/* ---------- Background layers ---------- */
#constellation {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.8;
}
.aurora {
  position: fixed; inset: -20% -10% auto -10%; height: 70vh; z-index: 0;
  pointer-events: none; filter: blur(80px); opacity: 0.5;
  background:
    radial-gradient(40% 60% at 25% 30%, rgba(255,255,255,0.06), transparent 70%),
    radial-gradient(45% 55% at 78% 18%, rgba(255,255,255,0.05), transparent 70%),
    radial-gradient(35% 45% at 55% 60%, rgba(255,255,255,0.03), transparent 70%);
  animation: drift 26s var(--ease) infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) scale(1.12); }
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%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");
  mix-blend-mode: overlay;
}

/* ---------- Layout helpers ---------- */
main { position: relative; z-index: 2; }
.section {
  max-width: var(--maxw); margin: 0 auto; padding: clamp(64px, 10vw, 128px) clamp(20px, 5vw, 40px);
}
.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.kicker {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--silver); display: inline-block; margin-bottom: 14px;
}
.kicker.center { display: block; text-align: center; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
.section-head h2 { font-size: clamp(28px, 4.4vw, 46px); }
.section-head p { color: var(--ink-dim); font-size: 17px; max-width: 660px; margin: 16px 0 0; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: #fff; color: #000; padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 16px clamp(20px, 5vw, 40px);
  backdrop-filter: blur(8px);
}
.nav::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 100%;
  background: linear-gradient(180deg, rgba(7,8,9,0.82), transparent);
  z-index: -1; pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: #0a0b0d;
  background: var(--accent-grad); box-shadow: 0 0 22px rgba(255,255,255,0.14);
}
.brand-name { font-size: 15px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-size: 14px; color: var(--ink-dim); transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  padding: 8px 16px; border: 1px solid var(--panel-brd); border-radius: 999px;
  color: var(--ink) !important; background: var(--panel);
}
.nav-cta:hover { border-color: var(--panel-brd-hi); box-shadow: 0 0 18px rgba(255,255,255,0.08); }

/* ---------- Hero ---------- */
.hero {
  position: relative; z-index: 2; min-height: 92vh; display: flex; flex-direction: column;
  justify-content: center; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(40px, 8vw, 80px) clamp(20px, 5vw, 40px) 60px;
}
.eyebrow {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim);
  display: flex; align-items: center; gap: 10px; margin: 0 0 22px;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--silver);
  box-shadow: 0 0 0 0 rgba(255,255,255,0.5); animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  70% { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.hero-title {
  font-size: clamp(48px, 9vw, 104px); font-weight: 700; letter-spacing: -0.04em;
  line-height: 0.98; margin: 0 0 8px;
  background: linear-gradient(180deg, #ffffff, #aab0ba);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-role {
  font-size: clamp(20px, 3.4vw, 34px); font-weight: 500; margin: 0 0 26px; color: var(--ink);
}
.rotator {
  color: #ffffff; font-weight: 700;
  border-right: 2px solid var(--silver); padding-right: 4px;
}
.role-tail { color: var(--ink-dim); }
.hero-lede {
  max-width: 660px; font-size: clamp(16px, 2vw, 19px); color: var(--ink-dim); margin: 0 0 34px;
}
.hero-lede strong { color: var(--ink); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 44px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 500; transition: transform 0.2s var(--ease), box-shadow 0.25s, border-color 0.2s, background 0.2s;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary {
  color: #0a0b0d; background: #ffffff; font-weight: 600;
  box-shadow: 0 8px 30px rgba(255,255,255,0.12);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(255,255,255,0.22); }
.btn-ghost { color: var(--ink); background: var(--panel); border-color: var(--panel-brd); }
.btn-ghost:hover { border-color: var(--panel-brd-hi); transform: translateY(-2px); box-shadow: 0 0 22px rgba(255,255,255,0.06); }

.hero-stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 5vw, 52px); }
.stat { display: flex; flex-direction: column; }
.stat b {
  font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; color: #ffffff;
}
.stat span { font-size: 13px; color: var(--ink-faint); font-family: var(--font-mono); }

.scroll-cue {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 1px solid var(--panel-brd); border-radius: 20px;
  background: transparent; cursor: pointer;
}
.scroll-cue span {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 8px; border-radius: 2px; background: var(--silver);
  animation: cue 1.8s infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translate(-50%, 0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 14px); } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.about-copy p { color: var(--ink-dim); font-size: 17px; margin: 0 0 18px; }
.about-copy strong { color: var(--ink); }
.about-copy em { color: var(--silver); font-style: normal; }
.tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.tags span {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
  padding: 6px 12px; border: 1px solid var(--panel-brd); border-radius: 999px; background: var(--panel);
}
.about-card {
  background: var(--panel); border: 1px solid var(--panel-brd); border-radius: var(--radius);
  padding: 26px; position: relative; overflow: hidden;
}
.about-card::before {
  content: ""; position: absolute; inset: 0; padding: 1px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255,255,255,0.28), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.about-card h3 { font-size: 14px; font-family: var(--font-mono); color: var(--silver); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 18px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.timeline li:last-child { border-bottom: none; }
.timeline b { font-size: 15px; }
.timeline span { font-size: 12.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.edu { margin: 16px 0 0; font-size: 13px; color: var(--ink-dim); font-family: var(--font-mono); }

/* ---------- Pillars ---------- */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar {
  background: var(--panel); border: 1px solid var(--panel-brd); border-radius: var(--radius);
  padding: 28px; transition: transform 0.3s var(--ease), border-color 0.3s;
}
.pillar:hover { transform: translateY(-4px); border-color: var(--panel-brd-hi); }
.pillar.glow {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.22);
}
.pillar.glow .pillar-num { color: #ffffff; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.28); }
.pillar-num {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--silver);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.16); margin-bottom: 18px;
}
.pillar h3 { font-size: 19px; margin-bottom: 10px; }
.pillar p { color: var(--ink-dim); font-size: 15px; margin: 0; }

/* ---------- Work ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.work-card {
  position: relative; background: var(--panel); border: 1px solid var(--panel-brd);
  border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column;
  min-height: 240px; overflow: hidden; transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.3s;
  transform-style: preserve-3d;
}
.work-card::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,0.08), transparent 45%);
  pointer-events: none;
}
.work-card:hover { border-color: var(--panel-brd-hi); box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.work-card:hover::after { opacity: 1; }
.work-card.featured { grid-column: span 2; background: rgba(255,255,255,0.055); }
.work-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.work-badge {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--silver); padding: 5px 10px; border: 1px solid rgba(255,255,255,0.18); border-radius: 999px;
  background: rgba(255,255,255,0.04);
}
.work-arrow { font-size: 18px; color: var(--ink-dim); transition: transform 0.2s, color 0.2s; }
.work-card:hover .work-arrow { transform: translate(3px, -3px); color: #ffffff; }
.work-card h3 { font-size: 24px; margin-bottom: 4px; }
.work-tag { font-family: var(--font-mono); font-size: 12.5px; color: var(--silver-soft); margin: 0 0 14px; }
.work-card > p { color: var(--ink-dim); font-size: 15px; margin: 0 0 16px; }
.work-card code { font-family: var(--font-mono); font-size: 0.85em; color: var(--ink); background: rgba(255,255,255,0.07); padding: 1px 5px; border-radius: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.chips span {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
  padding: 4px 10px; border: 1px solid var(--panel-brd); border-radius: 999px;
}

/* ---------- Writing ---------- */
.writing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.note {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--panel-brd); border-radius: var(--radius);
  padding: 26px; transition: transform 0.25s var(--ease), border-color 0.25s;
}
.note:hover { transform: translateY(-4px); border-color: var(--panel-brd-hi); }
.note-top { display: flex; justify-content: space-between; align-items: center; }
.note-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--silver-soft); }
.note-claps { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.note h3 { font-size: 20px; margin: 12px 0 12px; }
.note p { color: var(--ink-dim); font-size: 15px; margin: 0 0 16px; }
.note-links { margin-top: auto; display: flex; gap: 16px; }
.note-link { font-family: var(--font-mono); font-size: 13px; color: var(--silver); }
.note-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.writing-foot { text-align: center; margin-top: 30px; color: var(--ink-dim); font-family: var(--font-mono); font-size: 14px; }
.writing-foot a { color: var(--silver); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Collab ---------- */
.collab { display: flex; justify-content: center; }
.collab-box {
  max-width: 760px; width: 100%; text-align: center; padding: clamp(36px, 6vw, 64px);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-brd); border-radius: 28px; position: relative; overflow: hidden;
}
.collab-box::before {
  content: ""; position: absolute; inset: -40% 30% auto; height: 80%; filter: blur(80px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,255,255,0.10), transparent 70%);
  pointer-events: none;
}
.collab-box h2 { font-size: clamp(30px, 5vw, 48px); margin-bottom: 16px; }
.collab-box > p { color: var(--ink-dim); font-size: 17px; max-width: 560px; margin: 0 auto 30px; }
.collab-box > p strong { color: var(--ink); }
.collab-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Footer ---------- */
.footer {
  position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto;
  padding: 30px clamp(20px, 5vw, 40px) 48px; display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; border-top: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint);
}

/* ---------- Picture-in-picture tour ---------- */
.pip-launch {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px 13px 22px;
  border-radius: 999px; border: 1px solid var(--panel-brd); background: rgba(12,13,15,0.85);
  backdrop-filter: blur(10px); color: var(--ink); font-family: var(--font-sans); font-size: 14px;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.3s; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.pip-launch:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(255,255,255,0.1); }
.pip-launch-ring {
  width: 10px; height: 10px; border-radius: 50%; background: var(--silver);
  box-shadow: 0 0 0 0 rgba(255,255,255,0.5); animation: pulse 2.2s infinite;
}
.pip {
  position: fixed; right: 22px; bottom: 22px; z-index: 61; width: 320px; max-width: calc(100vw - 44px);
  background: rgba(11,13,15,0.94); backdrop-filter: blur(16px);
  border: 1px solid var(--panel-brd); border-radius: 16px; padding: 16px 18px 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6); animation: pipIn 0.4s var(--ease);
}
@keyframes pipIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
.pip-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pip-title { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--silver); display: flex; align-items: center; gap: 8px; }
.pip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--silver); box-shadow: 0 0 10px rgba(255,255,255,0.5); }
.pip-close { background: none; border: none; color: var(--ink-dim); font-size: 22px; line-height: 1; cursor: pointer; }
.pip-close:hover { color: var(--ink); }
.pip-step { font-size: 15px; color: var(--ink); margin: 0 0 14px; min-height: 44px; }
.pip-controls { display: flex; justify-content: space-between; align-items: center; }
.pip-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.pip-btns { display: flex; gap: 8px; }
.pip-btn { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--panel-brd); background: var(--panel); color: var(--ink); font-size: 13px; cursor: pointer; transition: 0.2s; }
.pip-btn:hover { border-color: var(--panel-brd-hi); }
.pip-btn.primary { background: #ffffff; color: #0a0b0d; font-weight: 600; border: none; }
.pip-progress { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.pip-progress span { display: block; height: 100%; width: 16%; background: #ffffff; transition: width 0.4s var(--ease); }

/* section spotlight during tour */
.tour-spot { position: relative; }
.tour-spot::before {
  content: ""; position: absolute; inset: -14px -10px; border-radius: 20px; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4), 0 0 60px rgba(255,255,255,0.10); z-index: 5;
  animation: spot 1.6s ease infinite alternate;
}
@keyframes spot { from { opacity: 0.4; } to { opacity: 1; } }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .pillars, .work-grid, .writing-grid { grid-template-columns: 1fr; }
  .work-card.featured { grid-column: span 1; }
}
@media (max-width: 560px) {
  .footer { flex-direction: column; }
  .pip { width: calc(100vw - 44px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  #constellation, .aurora { display: none; }
}
