@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&display=swap');

/* ============================================
   DESIGN SYSTEM - Prakhar Doneria Portfolio
   ============================================ */

:root {
  /* Color Palette - High Contrast & Readability */
  --primary: #6366F1;
  --primary-light: #818CF8;
  --primary-dark: #4F46E5;
  --accent: #A5B4FC;

  --bg-main: #FAFAFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F5FF;
  --bg-hero: linear-gradient(180deg, rgba(250, 250, 255, 0) 0%, rgba(250, 250, 255, 0.95) 80%, #FAFAFF 100%);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --border: rgba(99, 102, 241, 0.12);
  --border-hover: rgba(99, 102, 241, 0.3);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.06);
  --shadow-md: 0 8px 30px rgba(99, 102, 241, 0.1);
  --shadow-lg: 0 20px 50px rgba(99, 102, 241, 0.15);
  --shadow-xl: 0 30px 80px rgba(99, 102, 241, 0.2);

  /* Typography */
  --font-main: 'Josefin Sans', -apple-system, BlinkMacSystemFont, sans-serif;

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

  /* Sizing */
  --nav-height: 80px;
  --container-max: 1280px;
  --container-narrow: 900px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE RESET & DEFAULTS
   ============================================ */

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

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

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-main);
  overflow-x: hidden;
}

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

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

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

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

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--transition-slow),
    transform 0.8s var(--transition-slow);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   NAVIGATION
   ============================================ */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, box-shadow 0.3s ease;
  transform: translateY(-100%);
  opacity: 0;
}

nav.nav-visible {
  transform: translateY(0);
  opacity: 1;
  box-shadow: 0 4px 30px rgba(99, 102, 241, 0.1);
}

nav.nav-scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 30px rgba(99, 102, 241, 0.15);
}

.logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  transition: var(--transition-fast);
}

.logo:hover {
  color: var(--primary-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  padding: var(--space-xs) 0;
  transition: var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a:hover::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: var(--space-xs);
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

/* ============================================
   HERO SECTION
   ============================================ */

#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-height) + var(--space-3xl)) var(--space-lg) var(--space-3xl);
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(1.5);
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

#hero-video {
  opacity: 0;
  transition: opacity 1.5s ease;
}

#hero-video.ready {
  opacity: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-hero);
  z-index: -1;
}

.hero-content {
  max-width: 800px;
  text-align: center;
  z-index: 1;
}

.hero-image {
  width: 180px;
  height: 180px;
  margin: 0 auto var(--space-2xl);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow-lg);
  animation: float 6s ease-in-out infinite;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-lg);
}

.hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: var(--radius-full);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -2px;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 3vw, 1.375rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
}

/* ============================================
   SECTIONS
   ============================================ */

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

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.section-description {
  max-width: 600px;
  margin: var(--space-md) auto 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ============================================
   STATS SECTION
   ============================================ */

#stats {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3xl) 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.stat-item {
  text-align: center;
  padding: var(--space-lg);
}

.stat-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   CARDS
   ============================================ */

.card-grid {
  display: grid;
  gap: var(--space-lg);
}

.card-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  font-size: 1.5rem;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.card-description {
  color: var(--text-secondary);
  line-height: 1.7;
  flex-grow: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.card-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-link {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: var(--transition-fast);
}

.card-link:hover {
  gap: var(--space-sm);
}

/* ============================================
   SKILLS GRID
   ============================================ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
}

.skill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition-base);
}

.skill-item:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   TIMELINE
   ============================================ */

.timeline {
  max-width: var(--container-narrow);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: var(--transition-base);
}

.timeline-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.timeline-date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.timeline-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.timeline-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.timeline-description {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.footer-brand .logo {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  display: block;
}

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
}

.footer-links a {
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-credits {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-credits a {
  color: var(--primary);
  font-weight: 600;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {

  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  nav {
    padding: 0 var(--space-lg);
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-card);
    padding: var(--space-lg);
    gap: 0;
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    padding: var(--space-md);
    width: 100%;
    text-align: center;
    border-radius: var(--radius-md);
  }

  .nav-links a:hover {
    background: var(--bg-elevated);
  }

  .nav-links a::after {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .card-grid-2,
  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .footer-top {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

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

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  .hero-image {
    width: 140px;
    height: 140px;
  }
}

/* ============================================
   MOBILE SWIPE CARDS
   ============================================ */

@media (max-width: 768px) {

  /* Swipe Card Container */
  .swipe-container {
    position: relative;
    width: 100%;
    height: 420px;
    perspective: 1000px;
    overflow: visible;
  }

  /* Stacked Cards */
  .swipe-container .card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    min-height: 350px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.4s ease, opacity 0.4s ease, box-shadow 0.3s ease;
    touch-action: pan-x;
    user-select: none;
    cursor: grab;
  }

  .swipe-container .card:active {
    cursor: grabbing;
  }

  /* Active Card (top of stack) */
  .swipe-container .card.swipe-active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
    z-index: 10;
    box-shadow: var(--shadow-lg);
  }

  /* Next Card (peek behind) */
  .swipe-container .card.swipe-next {
    opacity: 0.6;
    pointer-events: none;
    transform: scale(0.95) translateY(15px);
    z-index: 5;
  }

  /* Third Card (peek behind next) */
  .swipe-container .card.swipe-third {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.9) translateY(30px);
    z-index: 1;
  }

  /* Swipe Animations */
  .swipe-container .card.swiping-left {
    animation: swipeLeft 0.4s ease forwards;
  }

  .swipe-container .card.swiping-right {
    animation: swipeRight 0.4s ease forwards;
  }

  @keyframes swipeLeft {
    0% {
      transform: translateX(0) rotate(0);
      opacity: 1;
    }

    100% {
      transform: translateX(-120%) rotate(-15deg);
      opacity: 0;
    }
  }

  @keyframes swipeRight {
    0% {
      transform: translateX(0) rotate(0);
      opacity: 1;
    }

    100% {
      transform: translateX(120%) rotate(15deg);
      opacity: 0;
    }
  }

  /* Swipe Hint */
  .swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    animation: hintPulse 2s ease-in-out infinite;
  }

  .swipe-hint-icon {
    display: flex;
    gap: 4px;
  }

  .swipe-hint-icon span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: hintDots 1.5s ease-in-out infinite;
  }

  .swipe-hint-icon span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .swipe-hint-icon span:nth-child(3) {
    animation-delay: 0.4s;
  }

  @keyframes hintPulse {

    0%,
    100% {
      opacity: 0.7;
    }

    50% {
      opacity: 1;
    }
  }

  @keyframes hintDots {

    0%,
    100% {
      transform: translateX(0);
    }

    50% {
      transform: translateX(5px);
    }
  }

  /* Card Counter */
  .swipe-counter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-md);
  }

  .swipe-counter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition-base);
  }

  .swipe-counter-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
  }

  /* Navigation Buttons */
  .swipe-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-md);
  }

  .swipe-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
  }

  .swipe-nav-btn:hover,
  .swipe-nav-btn:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
  }

  .swipe-nav-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
  }

  /* Hide default grid on mobile for swipeable sections */
  .card-grid.swipeable {
    display: block;
  }

  /* Skills Grid - Horizontal Scroll */
  .skills-grid {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-md);
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .skills-grid::-webkit-scrollbar {
    display: none;
  }

  .skills-grid .skill-item {
    flex: 0 0 auto;
    min-width: 140px;
    scroll-snap-align: start;
  }

  /* Stats - Horizontal Scroll */
  .stats-grid {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-sm);
    scrollbar-width: none;
  }

  .stats-grid::-webkit-scrollbar {
    display: none;
  }

  .stats-grid .stat-item {
    flex: 0 0 auto;
    min-width: 160px;
    scroll-snap-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--space-lg);
  }

  /* Timeline - swipeable */
  .timeline.swipeable {
    position: relative;
    height: 380px;
    overflow: visible;
  }

  .timeline.swipeable .timeline-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
    transition: all 0.4s ease;
  }

  .timeline.swipeable .timeline-item.swipe-active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 10;
  }

  .timeline.swipeable .timeline-item.swipe-next {
    opacity: 0.5;
    transform: scale(0.95) translateY(10px);
    z-index: 5;
  }
}

/* Desktop - hide mobile-only elements */
@media (min-width: 769px) {

  .swipe-hint,
  .swipe-counter,
  .swipe-nav,
  .mobile-only {
    display: none !important;
  }
}