:root {
  /* Luxury Light Minimal Palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  /* Soft Apple off-white */
  --text-primary: #1d1d1f;
  --text-secondary: #333333;
  /* Darker charcoal for readability */
  --accent-color: #0071e3;
  /* Apple Blue */
  --accent-hover: #0077ED;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --border-color: rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-family-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --h1-size: clamp(3.5rem, 8vw, 6rem);
  --h2-size: clamp(2.5rem, 5vw, 4rem);
  --h3-size: 1.5rem;
  --body-size: 1.125rem;

  /* Spacing - Condensed */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 4rem;
  --spacing-xxl: 6rem;

  /* Layout */
  --container-max-width: 1200px;
  --border-radius-pill: 9999px;
  --border-radius-card: 24px;
}

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

body {
  font-family: var(--font-family-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Styles */
h1,
h2,
h3 {
  font-family: var(--font-family-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-md);
  line-height: 1.05;
}

.text-gradient {
  background: linear-gradient(135deg, #0044b3, #8a2be2);
  /* Darker blue for better AA contrast */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

h1 {
  font-size: var(--h1-size);
}

h2 {
  font-size: var(--h2-size);
}

h3 {
  font-size: var(--h3-size);
}

p {
  font-size: var(--body-size);
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: var(--spacing-lg);
  max-width: 700px;
}

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

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

/* Layout Classes */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.section {
  padding: var(--spacing-xxl) 0;
}

/* Minimalist Divider */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: var(--spacing-xl) 0;
}

/* Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  transition: height 0.3s ease;
}

.navbar.scrolled .navbar-content {
  height: 48px;
}

.navbar.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

.nav-logo {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

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

/* Buttons */
.btn {
  display: inline-block;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border-radius: var(--border-radius-pill);
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 113, 227, 0.24);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
  transform: scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.32);
}

/* Footer */
.footer {
  padding: var(--spacing-xl) 0;
  background-color: #1d1d1f;
  color: #ffffff;
  text-align: center;
}

.footer h2 {
  color: #ffffff;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
}

.social-links {
  display: flex;
  gap: var(--spacing-md);
}

.social-links a {
  color: #a1a1a6;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: #ffffff;
}

.footer p {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: #ffffff;
}

.footer p a {
  color: #ffffff;
  text-decoration: underline;
  transition: color 0.3s ease;
}

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

/* --- LAYOUT AND PAGE SPECIFIC STYLES --- */

/* Hero Section */
.hero {
  min-height: 80vh;
  /* Restored elegant full-screen feel */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 160px;
  /* Offset for navbar */
  padding-bottom: 6rem;
  /* Natural breathing room before gray section */
  background: var(--bg-primary);
  /* Pure white */
}

.hero-content h1 {
  color: var(--text-primary);
  margin-bottom: calc(var(--spacing-md) + 8px);
}

.hero-subtitle {
  font-size: 1.25rem;
  margin: 0 auto var(--spacing-lg) auto;
  font-weight: 400;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-top: 0;
  /* Paragraph margin-bottom handles the gap */
}

/* Projects Section & Grid */
.projects-section {
  background-color: var(--bg-secondary);
  padding-top: var(--spacing-xl);
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  /* Reduced to visually connect with cards */
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-lg);
}

.project-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-card);
  overflow: hidden;
  border: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
  position: relative;
}

.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius-card);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.project-card:hover::after {
  opacity: 1;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(0, 113, 227, 0.18), 0 0 0 1.5px rgba(0, 113, 227, 0.12);
}

.project-image {
  height: 300px;
  background-color: var(--bg-secondary);
  /* Fallback */
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border-color);
}

.project-info {
  padding: var(--spacing-lg);
  flex-grow: 1;
}

.project-info h3 {
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  transition: color 0.3s ease;
}

.project-card:hover .project-info h3 {
  color: var(--accent-color);
}

.project-info p {
  font-size: 0.95rem;
  margin-bottom: 0;
  color: var(--text-secondary);
}

/* Project Detail Pages */
.project-hero {
  padding-top: 100px;
  /* Reduced top padding */
  text-align: center;
  padding-bottom: var(--spacing-xl);
}

.project-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
}

.project-media-full {
  width: 100%;
  overflow: hidden;
}

.project-grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

.apple-list {
  list-style: none;
  padding-left: 0;
}

.apple-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.apple-list li::before {
  content: '•';
  color: var(--accent-color);
  position: absolute;
  left: 0;
  font-size: 1.5rem;
  line-height: 1;
  top: -2px;
}

.sidebar-card {
  background-color: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-card);
  border: 1px solid var(--border-color);
  position: sticky;
  top: 100px;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.tag {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-pill);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .project-grid-2col {
    grid-template-columns: 1fr;
  }

  .sidebar-card {
    position: static;
  }
}

/* Cinematic Apple-Style Animations */
.fade-in-up,
.reveal-blur,
.reveal-scale {
  opacity: 0;
}

.fade-in-up {
  transform: translateY(30px);
  transition: opacity 1s cubic-bezier(0.165, 0.84, 0.44, 1), transform 1s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-blur {
  transform: translateY(40px);
  filter: blur(10px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    filter 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity, filter;
}

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

.reveal-scale {
  transform: translateY(40px) scale(0.95);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

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

/* Override: ensure hover lift wins over resting animation state */
.project-card.reveal-scale.visible:hover {
  transform: translateY(-8px) scale(1);
}

/* Stagger Delays */
.delay-1 {
  transition-delay: 0.15s;
}

.delay-2 {
  transition-delay: 0.30s;
}

.delay-3 {
  transition-delay: 0.45s;
}

/* ── Navbar Scroll Shrink ─────────────────────────────────────────────────── */
.navbar {
  transition: box-shadow 0.4s ease;
}

/* ── Typewriter Cursor ───────────────────────────────────────────────────── */
.typewriter-text::after {
  content: '|';
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-color);
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ── Hero Stats Bar ───────────────────────────────────────────────────────── */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg) var(--spacing-xl);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 20px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent-color);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Base Responsive Styles */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 1100;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  /* Make nav links a drop-down card style */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    flex-direction: column;
    padding: 1.5rem 0;
    gap: 1.5rem;
    display: none; /* hidden by default */
  }

  .nav-links.active {
    display: flex;
  }

  .hero {
    min-height: auto;
    padding-top: 120px;
    padding-bottom: 3rem;
  }

  .hero-content h1 {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
  }

  /* Stats bar wrap */
  .hero-stats {
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: var(--spacing-md) var(--spacing-lg);
    max-width: 100%;
  }

  /* Tighten styling and grids */
  .section {
    padding: 3rem 0;
  }

  .container {
    padding: 0 1rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-image {
    height: 220px;
  }

  .project-hero {
    padding-top: 100px;
    padding-bottom: var(--spacing-lg);
  }

  .project-hero h1 {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
  }

  .project-media-full img {
    height: 40vh !important;
  }

  .footer {
    padding: 2.5rem 0;
  }
}