/* ============================================================
   Savitur Swarup · personal site
   Palette: warm near-black, bone type, one cool accent
   ============================================================ */

:root {
  --bg:        #0b0b0d;
  --bg-warm:   #101015;
  --panel:     #141419;
  --line:      rgba(237, 234, 227, 0.08);
  --line-2:    rgba(237, 234, 227, 0.14);
  --text:      #ece9e2;
  --muted:     #9a978f;
  --muted-2:   #6d6b66;
  --accent:    #a9a6d6;   /* cool moonlit lavender-grey */
  --accent-2:  #c7b89a;   /* warm secondary, used sparingly */
  --max:       1120px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

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

a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--text); }
strong { font-weight: 600; color: #fff; }

/* ---------- ambient layers ---------- */

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.aura {
  position: fixed; z-index: 0; pointer-events: none;
  top: -20vh; left: 50%; transform: translateX(-50%);
  width: 90vw; height: 90vh; max-width: 1100px;
  background: radial-gradient(closest-side,
    rgba(169, 166, 214, 0.16),
    rgba(169, 166, 214, 0.05) 55%,
    transparent 72%);
  filter: blur(10px);
  animation: aura-breathe 9s ease-in-out infinite;
}
@keyframes aura-breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

.scroll-prog {
  position: fixed; top: 0; left: 0; z-index: 60;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: 0 50%;
  will-change: transform;
}

.cursor-glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(169,166,214,0.10), transparent 70%);
  transform: translate(-50%, -50%);
  left: -600px; top: -600px;
  transition: opacity 0.4s ease;
  opacity: 0;
}

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

main { position: relative; z-index: 2; }

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8.5rem 2rem;
  border-top: 1px solid var(--line);
}

.section__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3.5rem;
  display: flex; align-items: center; gap: 0.9rem;
}
.section__label span {
  color: var(--accent);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  font-size: 0.68rem;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- nav ---------- */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem clamp(1.2rem, 4vw, 3rem);
  transition: padding 0.4s var(--ease), background 0.4s ease, backdrop-filter 0.4s ease;
}
.nav.is-scrolled {
  padding-top: 0.9rem; padding-bottom: 0.9rem;
  background: rgba(11, 11, 13, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav__mark {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem; font-weight: 500; letter-spacing: 0.02em;
}
.nav__mark span { color: var(--accent); margin: 0 1px; }
.nav__links { display: flex; gap: 2rem; }
.nav__links a {
  font-size: 0.86rem; color: var(--muted);
  position: relative; transition: color 0.3s ease;
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -5px;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { width: 100%; }
.nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { width: 100%; background: var(--accent); }
.nav__resume {
  font-size: 0.82rem; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 100px;
  padding: 0.5rem 1.1rem; transition: all 0.3s var(--ease);
}
.nav__resume:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */

.hero {
  min-height: 100svh;
  display: flex; align-items: center;
  max-width: var(--max); margin: 0 auto;
  padding: 7rem 2rem 4rem;
}
.hero__inner { width: 100%; min-width: 0; }
.hero .eyebrow { margin-bottom: 2rem; }

.hero__name {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(3rem, 8.5vw, 7rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  margin-bottom: 1.8rem;
}
.hero__name .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero__name .line > span {
  display: block; transform: translateY(115%);
  animation: line-up 1.05s var(--ease) forwards;
}
.hero__name .line:nth-child(1) > span { animation-delay: 0.10s; }
.hero__name .line:nth-child(2) > span { animation-delay: 0.24s; }
.hero__name .line:last-child { color: var(--muted); font-style: italic; }
@keyframes line-up { from { transform: translateY(115%); } to { transform: translateY(0); } }

.hero__tag {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  color: var(--text);
  line-height: 1.3;
  font-weight: 300;
  letter-spacing: -0.01em;
  margin-bottom: 0.7rem;
}
.hero__sub {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--muted);
  font-weight: 300;
  max-width: 42ch;
  margin-bottom: 2.5rem;
}

.hero__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--muted);
}
.hero__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }

.hero__status {
  display: inline-flex; align-items: flex-start; gap: 0.6rem;
  max-width: 100%;
  margin-top: 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem; letter-spacing: 0.02em; line-height: 1.5;
  color: var(--text);
  border: 1px solid var(--line-2); border-radius: 22px;
  padding: 0.55rem 1.1rem 0.55rem 0.9rem;
  background: rgba(126, 201, 143, 0.05);
}
.hero__status-txt { min-width: 0; }
.hero__status-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 0.32rem;
  background: #7ec98f; flex: none;
  box-shadow: 0 0 0 0 rgba(126, 201, 143, 0.55);
  animation: status-pulse 2.4s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(126, 201, 143, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(126, 201, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 201, 143, 0); }
}

.about__focus {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 2rem; padding-top: 1.8rem;
  border-top: 1px solid var(--line);
}
.about__focus span {
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem;
  color: var(--text); border: 1px solid var(--line-2); border-radius: 100px;
  padding: 0.4rem 0.9rem;
}

/* signature: live EEG trace */
.eeg { margin-top: 3.5rem; width: 100%; max-width: 680px; height: 60px; opacity: 0.9; }
.eeg svg { width: 100%; height: 100%; display: block; }
.eeg__path {
  fill: none; stroke: var(--accent); stroke-width: 1.4;
  stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(169,166,214,0.5));
  stroke-dasharray: 2600; stroke-dashoffset: 2600;
  animation: eeg-draw 3.2s var(--ease) 0.6s forwards, eeg-pulse 3s ease-in-out 3.8s infinite;
}
@keyframes eeg-draw { to { stroke-dashoffset: 0; } }
@keyframes eeg-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

.hero__scroll {
  display: inline-flex; align-items: center; gap: 0.8rem;
  margin-top: 3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}
.hero__scroll-line {
  width: 60px; height: 1px; background: var(--line-2); position: relative; overflow: hidden;
}
.hero__scroll-line::after {
  content: ''; position: absolute; inset: 0; background: var(--accent);
  transform: translateX(-100%); animation: sweep 2.4s var(--ease) infinite;
}
@keyframes sweep {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ---------- highlights band (low-friction "best of") ---------- */
.highlights { max-width: var(--max); margin: 0 auto; padding: 0 2rem; }
.hl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; }
.hl {
  position: relative; display: block;
  background: var(--bg-warm); padding: 1.7rem 1.6rem;
  border: 1px solid var(--line-2); border-radius: 12px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
}
.hl:hover {
  transform: translateY(-3px); border-color: var(--accent); background: #16161c;
}
.hl b {
  display: block; font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 1.75rem; line-height: 1; color: var(--text);
}
.hl span {
  display: block; margin-top: 0.55rem; max-width: 88%;
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.hl-go {
  position: absolute; top: 1.2rem; right: 1.3rem;
  font-style: normal; font-size: 0.95rem; color: var(--muted-2);
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
}
.hl:hover .hl-go { color: var(--accent); transform: translate(2px, -2px); }

/* ---------- about ---------- */

.about { display: grid; grid-template-columns: 300px 1fr; gap: 4rem; align-items: start; }
.about__photo {
  position: relative; aspect-ratio: 4 / 5; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--panel);
}
.about__photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.15) contrast(1.02); display: block; }
.about__photo-fallback {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(169,166,214,0.10), transparent 60%),
    linear-gradient(160deg, var(--panel), var(--bg-warm));
}
.about__photo.is-empty .about__photo-fallback { display: flex; }
.about__photo-mark {
  font-family: 'Fraunces', serif; font-size: 3.4rem; color: var(--text); letter-spacing: 0.02em;
}
.about__photo-mark i { color: var(--accent); font-style: normal; margin: 0 2px; }
.about__photo-cap {
  font-family: 'JetBrains Mono', monospace; font-size: 0.66rem;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted-2);
}
.about__photo.is-empty img { display: none; }

.about__text p { font-size: 1.08rem; color: var(--muted); margin-bottom: 1.4rem; max-width: 60ch; }
.about__text p strong, .about__text p em { color: var(--text); }
.about__facts {
  list-style: none; display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 2.5rem;
  padding-top: 2rem; border-top: 1px solid var(--line);
}
.about__facts li {
  font-family: 'Fraunces', serif; font-size: 1.15rem; color: var(--text);
}
.about__facts span {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 0.35rem;
}

/* ---------- rows (experience / research) ---------- */

.rows { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 220px 1fr; gap: 3rem;
  padding: 2.6rem 0; border-top: 1px solid var(--line);
  transition: background 0.4s ease;
}
.row:first-child { border-top: none; }
.row__meta { display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.4rem; }
.row__time {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  letter-spacing: 0.04em; color: var(--text);
}
.row__place { font-size: 0.82rem; color: var(--muted-2); }
.row__body h3 {
  font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 1.5rem; line-height: 1.25; margin-bottom: 0.9rem;
}
.row__org {
  display: block; font-size: 0.95rem; color: var(--accent);
  font-family: 'Inter', sans-serif; font-weight: 400; margin-top: 0.2rem;
}
.row__body p { color: var(--muted); font-size: 1rem; max-width: 62ch; }

.stats { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 1.8rem; }
.stat b {
  font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 400;
  color: var(--text); display: block; line-height: 1;
}
.stat span {
  font-family: 'JetBrains Mono', monospace; font-size: 0.66rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2);
  margin-top: 0.5rem; display: block;
}

/* ---------- projects (visual) ---------- */

.work { display: flex; flex-direction: column; gap: 5rem; }
.work__item { display: grid; grid-template-columns: 1.15fr 1fr; gap: 3.5rem; align-items: center; }
.work__item--reverse .work__shot { order: 2; }

.work__shot {
  display: block; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg-warm);
  box-shadow: 0 24px 60px -30px rgba(0,0,0,0.9);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.work__shot img { width: 100%; height: 100%; display: block; object-fit: cover; }
.work__shot:hover {
  transform: translateY(-4px); border-color: var(--accent);
  box-shadow: 0 32px 70px -28px rgba(0,0,0,1), 0 0 0 1px rgba(169,166,214,0.25);
}

.work__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.work__head h3 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 2rem; }
.work__tag {
  font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}
.work__body p { color: var(--muted); font-size: 1rem; margin-bottom: 1.5rem; }
.work__stack { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem; }
.work__stack span {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 100px;
  padding: 0.35rem 0.85rem;
}
.work__links a {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; color: var(--text);
  border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: all 0.3s var(--ease);
}
.work__links a:hover { color: var(--accent); border-color: var(--accent); }
.work__private {
  font-family: 'JetBrains Mono', monospace; font-size: 0.76rem;
  letter-spacing: 0.04em; color: var(--muted-2);
}

/* ---------- skills ---------- */

.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.5rem 4rem; }
.skills__group h4 {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 0.9rem; font-weight: 500;
}
.skills__group p { color: var(--muted); font-size: 1.02rem; line-height: 1.8; }

/* ---------- contact ---------- */

.section--contact { text-align: left; }
.contact h2 {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.5rem); line-height: 1.05; margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.contact > .reveal > p, .contact p { color: var(--muted); font-size: 1.1rem; margin-bottom: 2.5rem; }
.contact__links { display: flex; flex-wrap: wrap; gap: 1rem; }
.contact__links a {
  font-size: 0.95rem; padding: 0.8rem 1.6rem;
  border: 1px solid var(--line-2); border-radius: 100px;
  transition: all 0.3s var(--ease);
}
.contact__links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- footer ---------- */

.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  border-top: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.08em; color: var(--muted-2);
}

/* ---------- reveal animation ---------- */

.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero__scroll-line::after { animation: none; }
  .eeg__path { animation: none; stroke-dashoffset: 0; opacity: 0.75; }
  .hero__name .line > span { animation: none; transform: none; }
  .aura { animation: none; }
  .hero__status-dot { animation: none; }
  html { scroll-behavior: auto; }
}

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

@media (max-width: 820px) {
  .nav {
    flex-wrap: wrap; row-gap: 0.5rem;
    padding-top: max(0.95rem, env(safe-area-inset-top));
    padding-right: max(1.2rem, env(safe-area-inset-right));
    padding-bottom: 0.7rem;
    padding-left: max(1.2rem, env(safe-area-inset-left));
    background: rgba(11, 11, 13, 0.82);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
  }
  .nav__links {
    display: flex; order: 3; width: 100%; gap: 1.3rem;
    overflow-x: auto; padding-top: 0.5rem;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 4%, #000 92%, transparent);
  }
  .nav__links::-webkit-scrollbar { display: none; }
  .nav__links a { white-space: nowrap; font-size: 0.82rem; }

  .hero {
    padding: calc(128px + env(safe-area-inset-top))
             max(1.5rem, env(safe-area-inset-right)) 3rem
             max(1.5rem, env(safe-area-inset-left));
  }
  .hero__name { font-size: clamp(2.6rem, 15vw, 4.6rem); }
  .eyebrow { font-size: 0.66rem; letter-spacing: 0.2em; }
  .eeg { max-width: 100%; height: 48px; margin-top: 2.5rem; }

  .section {
    padding: 4.5rem max(1.4rem, env(safe-area-inset-right))
             4.5rem max(1.4rem, env(safe-area-inset-left));
  }
  .about { grid-template-columns: 1fr; gap: 2.5rem; }
  .about__photo { max-width: 240px; }
  .row { grid-template-columns: 1fr; gap: 1rem; }
  .row__meta { flex-direction: row; align-items: baseline; gap: 1rem; }
  .skills { grid-template-columns: 1fr; }

  .work { gap: 3rem; }
  .work__item, .work__item--reverse { grid-template-columns: 1fr; gap: 1.6rem; }
  .work__item--reverse .work__shot { order: 0; }

  .hl-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .hl { padding: 1.3rem 1.2rem; }
  .hl b { font-size: 1.4rem; }
  .hl span { font-size: 0.62rem; letter-spacing: 0.06em; }
}
