/* ============================================
   Nasir Sajad Bhat - Personal Website
   Institutional Grade, Light Theme, Red Accent
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette */
  --white: #ffffff;
  --off-white: #fafafa;
  --gray-50: #f5f5f7;
  --gray-100: #e8e8ed;
  --gray-200: #d2d2d7;
  --gray-400: #86868b;
  --gray-600: #6e6e73;
  --gray-800: #424245;
  --near-black: #1d1d1f;
  --black: #000000;

  /* Red accent */
  --accent: #e63946;
  --accent-dark: #c1121f;
  --accent-light: #fce4e6;
  --accent-glow: rgba(230, 57, 70, 0.12);

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 10rem;

  /* Layout */
  --max-width: 720px;
  --max-width-wide: 960px;
  --nav-height: 64px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.65;
  color: var(--near-black);
  background-color: var(--white);
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-dark);
}

img {
  max-width: 100%;
  display: block;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--near-black);
}

h1 {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 600;
}

h4 {
  font-size: 0.9375rem;
  font-weight: 600;
}

p {
  color: var(--gray-600);
  max-width: 60ch;
}

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

.text-large {
  font-size: clamp(1.125rem, 2vw, 1.35rem);
  line-height: 1.6;
}

.text-small {
  font-size: 0.875rem;
  color: var(--gray-400);
  letter-spacing: 0.01em;
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-400);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container--wide {
  max-width: var(--max-width-wide);
}

section {
  padding: var(--space-3xl) 0;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.3s ease;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.nav__logo {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--near-black);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.nav__links a {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--gray-600);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav__links a:hover,
.nav__links a.is-active {
  color: var(--near-black);
}

.nav__links a:hover::after,
.nav__links a.is-active::after {
  width: 100%;
}

/* Mobile toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav__toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--near-black);
  margin: 5px 0;
  transition: all 0.3s ease;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn--primary:hover {
  background: var(--accent-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(230, 57, 70, 0.25);
}

.btn--ghost {
  background: transparent;
  color: var(--near-black);
  border: 1.5px solid var(--gray-200);
}

.btn--ghost:hover {
  border-color: var(--near-black);
  color: var(--near-black);
  transform: translateY(-2px);
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  position: relative;
}

.hero__content {
  padding: var(--space-3xl) 0;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.hero__eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.hero__title {
  margin-bottom: var(--space-md);
}

.hero__subtitle {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--gray-600);
  max-width: 50ch;
  line-height: 1.5;
}

.hero__subtitle strong {
  color: var(--near-black);
  font-weight: 600;
}

.hero__meta {
  margin-top: var(--space-xl);
  display: flex;
  gap: var(--space-xl);
}

.hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero__meta-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
}

.hero__meta-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--near-black);
}

.hero__cta {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.hero__scroll-indicator {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: float 2.5s ease-in-out infinite;
}

.hero__scroll-indicator span {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-400);
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

@keyframes scrollPulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* --- Divider --- */
.divider {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  height: 1px;
  background: var(--gray-100);
}

/* --- Section Header --- */
.section-header {
  margin-bottom: var(--space-xl);
}

.section-header__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.section-header__eyebrow::before {
  content: '';
  width: 16px;
  height: 2px;
  background: var(--accent);
}

.section-header__title {
  margin-bottom: var(--space-sm);
}

.section-header__desc {
  font-size: 1.0625rem;
  max-width: 55ch;
}

.section-subheader {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.section-subheader h3 {
  margin-bottom: 4px;
}

/* --- Project Section --- */
.project {
  background: var(--gray-50);
}

.project__card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: 16px;
  padding: var(--space-xl);
  margin-top: var(--space-lg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.project__card + .project__card {
  margin-top: var(--space-md);
}

.project__card:hover {
  border-color: var(--gray-200);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.04);
}

.project__card--highlight {
  border-color: var(--accent-light);
  background: linear-gradient(135deg, var(--white), var(--accent-light));
}

.project__card--highlight:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 40px var(--accent-glow);
}

.project__card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--near-black);
  margin-bottom: var(--space-xs);
}

.project__card-subtitle {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-md);
  font-weight: 500;
}

.project__card-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--gray-600);
  max-width: 60ch;
}

.project__card-body p + p {
  margin-top: var(--space-sm);
}

.project__card-body strong {
  color: var(--near-black);
  font-weight: 600;
}

.project__pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.project__pillar {
  padding: var(--space-md);
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  background: var(--white);
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.project__pillar:hover {
  border-color: var(--accent-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.project__pillar-number {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.project__pillar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--near-black);
  margin-bottom: 6px;
}

.project__pillar-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--gray-600);
}

/* --- About Section --- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.about__bio {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--gray-600);
  max-width: 60ch;
}

.about__bio p + p {
  margin-top: var(--space-md);
}

.about__bio strong {
  color: var(--near-black);
  font-weight: 600;
}

.about__links-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--near-black);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.about__links {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  color: var(--near-black);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: padding-left 0.3s ease, color 0.2s ease;
}

.about__link:hover {
  padding-left: 8px;
  color: var(--accent);
}

.about__link-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--gray-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.about__link-arrow {
  font-size: 1rem;
  color: var(--gray-400);
  transition: transform 0.3s ease, color 0.2s ease;
}

.about__link:hover .about__link-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

/* --- FAQ Section --- */
.faq {
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.faq__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq__item {
  border-bottom: 1px solid var(--gray-100);
}

.faq__question {
  padding: var(--space-md) 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color 0.2s ease;
}

.faq__question::-webkit-details-marker {
  display: none;
}

.faq__question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--gray-400);
  transition: transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  margin-left: var(--space-sm);
}

.faq__item[open] .faq__question::after {
  content: '\2212';
  color: var(--accent);
  transform: rotate(180deg);
}

.faq__question h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--near-black);
  letter-spacing: -0.01em;
}

.faq__question:hover h3 {
  color: var(--accent);
}

.faq__answer {
  padding: 0 0 var(--space-md) 0;
}

.faq__answer p {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--gray-600);
  max-width: 55ch;
}

/* --- Footer --- */
.footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--gray-100);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--near-black);
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.footer__right {
  display: flex;
  gap: var(--space-md);
}

.footer__right a {
  font-size: 0.8125rem;
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer__right a:hover {
  color: var(--accent);
}

/* --- Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.stagger.is-visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger.is-visible > *:nth-child(3) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.stagger.is-visible > *:nth-child(4) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger.is-visible > *:nth-child(5) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }

/* --- Responsive --- */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  /* Lock body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
  }

  section {
    padding: var(--space-2xl) 0;
  }

  .nav__links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    padding: 8px 0;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                padding 0.35s ease;
    padding: 0;
  }

  .nav.is-open .nav__links {
    display: flex;
    max-height: 300px;
    opacity: 1;
    padding: 8px 0;
  }

  .nav__links li {
    list-style: none;
  }

  .nav__links a {
    display: block;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--near-black);
    letter-spacing: -0.01em;
    transition: color 0.15s ease, background 0.15s ease;
  }

  .nav__links a::after {
    display: none;
  }

  .nav__links a:hover,
  .nav__links a:active {
    color: var(--accent);
    background: var(--gray-50);
  }

  .nav__toggle {
    display: block;
    position: relative;
    z-index: 1001;
  }

  .nav.is-open .nav__toggle span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }

  .nav.is-open .nav__toggle span:nth-child(2) {
    opacity: 0;
  }

  .nav.is-open .nav__toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero__meta {
    flex-direction: column;
    gap: var(--space-md);
  }

  .hero__cta {
    flex-direction: column;
  }

  .hero__cta .btn {
    width: 100%;
  }

  .project__pillars {
    grid-template-columns: 1fr;
  }

  .project__card {
    padding: var(--space-md);
  }

  .footer__inner {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .hero__scroll-indicator {
    display: none;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2.25rem;
  }

  .hero__subtitle {
    font-size: 1.0625rem;
  }
}
