/* ============================================================
   Arvind Prajapati — Portfolio
   Clean minimal light + terminal/mono accents (from resume)
   ============================================================ */

:root {
  --accent: #6CA0DC;
  --bg: #fafaf8;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-soft: #4b5058;
  --ink-faint: #8a8f98;
  --line: #e6e6e2;
  --accent-ink: #3d72ab;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Space Grotesk", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --space-unit: 1;
  --section-gap: calc(140px * var(--space-unit));
  --block-gap: calc(56px * var(--space-unit));
}

:root[data-fonts="editorial"] {
  --font-display: "Newsreader", serif;
  --font-body: "Newsreader", serif;
}

:root[data-theme="dark"] {
  --bg: #101216;
  --surface: #181b21;
  --ink: #eceef1;
  --ink-soft: #b3b9c2;
  --ink-faint: #6f7680;
  --line: #272b33;
  --accent-ink: var(--accent);
}

:root[data-density="compact"] { --space-unit: 0.7; }
:root[data-density="airy"]    { --space-unit: 1.3; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; }

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

/* ---------- layout ---------- */

.frame {
  display: grid;
  grid-template-columns: 320px 1fr;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  gap: 72px;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 64px 0 48px 0;
}

.sidebar .brand-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  line-height: 1.1;
}

.sidebar .brand-role {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 56px 0;
}

.sidebar .brand-role::before { content: "> "; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.2s ease;
}

.side-nav a .tick {
  display: inline-block;
  width: 20px;
  height: 1px;
  background: currentColor;
  transition: width 0.25s ease;
}

.side-nav a:hover { color: var(--ink); }

.side-nav a.active { color: var(--ink); }
.side-nav a.active .tick { width: 44px; background: var(--accent); height: 2px; }

/* ---------- on-page theme controls ---------- */

.theme-controls {
  margin-top: auto;
  padding-bottom: 26px;
}

.theme-controls .foot-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  margin: 0 0 12px 0;
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.theme-toggle {
  position: relative;
  width: 54px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.theme-toggle:hover { border-color: var(--accent); }

.theme-toggle .theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5bd4f;
  transition: left 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.theme-toggle.on .theme-knob {
  left: 29px;
  background: var(--accent);
}

.accent-dots {
  display: flex;
  gap: 8px;
}

.accent-dots button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.accent-dots button:hover { transform: scale(1.18); }

.accent-dots button.active {
  border-color: var(--bg);
  box-shadow: 0 0 0 2px var(--ink-soft);
  transform: scale(1.12);
}

.sidebar .side-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-foot .foot-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  margin-bottom: 2px;
}

.side-foot a {
  font-family: var(--font-mono);
  font-size: 13.5px;
  text-decoration: none;
  color: var(--ink-soft);
  width: fit-content;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.side-foot a:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- main column ---------- */

.main { padding: 64px 0 120px 0; min-width: 0; }

.section { margin-bottom: var(--section-gap); }

.kicker {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 28px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.kicker::before { content: "//"; opacity: 0.55; }

.kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* hero */

.hero { padding-top: calc(40px * var(--space-unit)); }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 36px 0;
  text-wrap: balance;
  max-width: 16ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-ink);
}

.hero .hero-sub {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0;
  text-wrap: pretty;
}

.hero .hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 44px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
}

.hero .hero-meta .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3eb06f;
  box-shadow: 0 0 0 4px rgba(62, 176, 111, 0.15);
}

/* intro video */

.intro-video {
  margin-top: calc(56px * var(--space-unit));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: 0 12px 40px rgba(10, 14, 20, 0.12);
}

.intro-video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #0a0a0a;
}

.iv-caption { margin-top: 12px; }

/* story rows */

.story-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 56px;
  align-items: start;
  margin-bottom: var(--block-gap);
}

.story-row.flip { grid-template-columns: 280px 1fr; }

.story-row h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 16px 0;
}

.story-row p {
  color: var(--ink-soft);
  margin: 0 0 14px 0;
  text-wrap: pretty;
  max-width: 58ch;
}

.story-row p:last-child { margin-bottom: 0; }

.photo-stack { position: relative; }

.photo-caption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

/* AI loop mini-video */

.ai-loop-frame {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0c0f14;
  height: 240px;
}

.ai-loop-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

/* experience */

.xp-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 40px;
  padding: calc(36px * var(--space-unit)) 0;
  border-top: 1px solid var(--line);
}

.xp-item:last-child { border-bottom: 1px solid var(--line); }

.xp-when {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  padding-top: 5px;
  line-height: 1.5;
}

.xp-body h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

.xp-body .xp-org {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--accent-ink);
  margin: 0 0 16px 0;
}

.xp-body p { color: var(--ink-soft); margin: 0 0 14px 0; max-width: 60ch; text-wrap: pretty; }

.xp-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xp-points li {
  color: var(--ink-soft);
  padding-left: 26px;
  position: relative;
  max-width: 58ch;
  text-wrap: pretty;
}

.xp-points li::before {
  content: "‣";
  position: absolute;
  left: 4px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
}

/* education */

.edu-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 40px;
  padding: calc(26px * var(--space-unit)) 0;
  border-top: 1px solid var(--line);
}

.edu-item:last-child { border-bottom: 1px solid var(--line); }

.edu-when { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); padding-top: 3px; }

.edu-body h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 0 0 4px 0; }

.edu-body p { margin: 0; color: var(--ink-soft); font-size: 15.5px; }

.edu-body .edu-note { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; }

/* skills */

.skill-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(40px * var(--space-unit)) 56px;
}

.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  margin: 0 0 16px 0;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chip:hover { border-color: var(--accent); color: var(--ink); }

.chip.lead { border-color: var(--accent); color: var(--accent-ink); }

/* projects */

.project.featured {
  margin-bottom: calc(64px * var(--space-unit));
}

.project-shot { margin-bottom: 28px; }

.project-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 14px;
}

.project-index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-ink);
  letter-spacing: 0.1em;
}

.project-head h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}

.project-role {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 4px 0 0 0;
}

.project-live {
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--accent-ink);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  white-space: nowrap;
}

.project-live:hover { border-color: var(--accent); }

.project-desc {
  color: var(--ink-soft);
  margin: 0 0 16px 0;
  max-width: 62ch;
  text-wrap: pretty;
}

.project-stack { margin-top: 20px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.project.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 20px 22px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.project.card:hover { border-color: var(--accent); transform: translateY(-3px); }

.project-grid { perspective: 900px; }

.project.card image-slot { margin-bottom: 18px; }

.project.card .project-head { gap: 12px; margin-bottom: 10px; grid-template-columns: auto 1fr; }

.project.card h3 { font-size: 18px; }

.project.card .project-desc { font-size: 15px; flex: 1; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
}

/* AI section */

.ai-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: calc(44px * var(--space-unit)) calc(48px * var(--space-unit));
}

.ai-card .prompt-line {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0 0 20px 0;
}

.ai-card .prompt-line .caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ai-card .prompt-line .caret { animation: none; }
}

.ai-card blockquote {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 0 0 24px 0;
  text-wrap: balance;
}

.ai-card blockquote em { font-style: normal; color: var(--accent-ink); }

.ai-card p { color: var(--ink-soft); margin: 0 0 28px 0; max-width: 60ch; text-wrap: pretty; }

/* contact */

.contact h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 20px 0;
  max-width: 18ch;
  text-wrap: balance;
}

.contact .contact-sub { color: var(--ink-soft); margin: 0 0 44px 0; max-width: 52ch; }

.contact-links { display: flex; flex-direction: column; }

.contact-links a {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 20px 4px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: padding 0.25s ease, background 0.25s ease, transform 0.3s ease;
}

.contact-links a:last-child { border-bottom: 1px solid var(--line); }

.contact-links .cl-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.contact-links .cl-value {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
}

.contact-links .cl-arrow {
  font-family: var(--font-mono);
  color: var(--ink-faint);
  transition: transform 0.25s ease, color 0.25s ease;
}

.contact-links a:hover { padding-left: 14px; }
.contact-links a:hover .cl-arrow { transform: translateX(4px); color: var(--accent-ink); }

.colophon {
  margin-top: calc(90px * var(--space-unit));
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* reveal on scroll */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  .reveal.in { opacity: 1; transform: none; }

  /* staggered children — hidden only while parent .reveal is not yet .in,
     so the reveal fail-safe also covers these */
  .reveal:not(.in) .chip,
  .reveal:not(.in) .xp-points li {
    opacity: 0;
    transform: translateY(12px);
  }
  .reveal.in .chip,
  .reveal.in .xp-points li {
    opacity: 1;
    transform: none;
    transition: opacity 0.55s ease, transform 0.55s ease;
    transition-delay: var(--d, 0s);
  }

  /* kicker rule draws in when section enters */
  .kicker::after {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
  }
  .kicker.in::after { transform: scaleX(1); }

  /* settled: transitions done (or context can't run them) — snap to final
     state so throttled/capture contexts never show the hidden start value */
  .reveal.in.settled,
  .reveal.in.settled .chip,
  .reveal.in.settled .xp-points li,
  .kicker.in.settled::after { transition: none; }
}

/* scroll progress */

#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--accent);
  z-index: 1000;
  pointer-events: none;
}

/* typed sidebar role */

.brand-role .type-caret {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--accent);
  vertical-align: -1px;
  margin-left: 3px;
  animation: blink 1.1s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .brand-role .type-caret { animation: none; }
}

/* photo slots lift slightly on hover */

.photo-stack image-slot {
  display: block;
  transition: transform 0.35s ease;
}

.photo-stack:hover image-slot { transform: translateY(-4px); }

/* ---------- cursor trail ---------- */

#cursorTrail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

:root:not([data-cursor="on"]) #cursorTrail { display: none; }

@media (pointer: coarse) {
  #cursorTrail { display: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .frame { grid-template-columns: 1fr; gap: 0; padding: 0 28px; }

  .sidebar {
    position: static;
    height: auto;
    padding: 44px 0 8px 0;
  }

  .sidebar .brand-role { margin-bottom: 28px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 10px 22px; }
  .side-nav a .tick { display: none; }
  .sidebar .side-foot { display: none; }

  /* theme controls become a floating pill on mobile */
  .theme-controls {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 200;
    margin: 0;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(22, 24, 29, 0.14);
  }
  .theme-controls .foot-label { display: none; }
  .theme-row { gap: 12px; }

  .main { padding-top: 40px; }
  .story-row, .story-row.flip { grid-template-columns: 1fr; gap: 28px; }
  .story-row.flip .photo-stack { order: 2; }
  .xp-item, .edu-item { grid-template-columns: 1fr; gap: 8px; }
  .skill-groups { grid-template-columns: 1fr; }
  .contact-links a { grid-template-columns: 1fr auto; }
  .contact-links .cl-label { display: none; }
}
