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

:root {
  --bg: #000;
  --fg: #f5f5f7;          /* Apple's off-white */
  --secondary: #86868b;   /* Apple's secondary text gray */
  --muted: #424245;       /* Apple's muted/border gray */
  --border: rgba(255, 255, 255, 0.1);
  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── LOADER ── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.5s ease;
}
#loader.hidden { opacity: 0; pointer-events: none; }

#loader-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary);
}

#loader-bar {
  width: 160px;
  height: 1px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

#loader-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 0%;
  background: var(--fg);
  transition: width 0.05s linear;
}

/* ── NAV ── */
/* Add relative positioning to the links so we can attach an underline */
.nav-links a {
  position: relative;
  /* ... keep your existing styles ... */
}

/* Create the underline (hidden by default) */
.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px; /* Very thin, clean line */
  bottom: -4px;
  left: 0;
  background-color: var(--fg);
  transition: width 0.3s ease; /* Smooth animation */
}

/* The active state makes the text white and expands the underline */
.nav-links a.active {
  color: var(--fg);
}

.nav-links a.active::after {
  width: 100%;
}
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.nav-links { display: flex; gap: 32px; }
.nav-links a {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--fg); }

.nav-socials { display: flex; gap: 20px; }
.nav-socials a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-socials a:hover { color: var(--fg); }

/* ── NAV RIGHT CONTAINER & HAMBURGER ── */
.nav-right-container {
  display: flex;
  align-items: center;
  position: relative;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  padding: 4px;
}

/* ── MAIN ── */
main { padding-top: 52px; }

section {
  padding: 100px 48px;
  max-width: 980px;
  margin: 0 auto;
  scroll-margin-top: 52px; /* Keep this so the navbar doesn't hide content */
}
#projects {
  min-height: 100vh; 
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── HERO ── */
#home {
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 80px;
  padding-bottom: 80px;
}

.hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 40px;
  display: block;
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
}

/* Apple-style headline: bold, very tight tracking, large */
h1 {
  font-family: var(--sans);
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--fg);
  margin-bottom: 24px;
}

h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* Apple uses a larger, comfortable body size with generous leading */
.hero-bio {
  font-size: 21px;
  font-weight: 400;
  color: var(--secondary);
  max-width: 580px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  margin-bottom: 40px;
}

.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; }

/* Apple-style pill buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: 980px;       /* full pill */
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border: 1.5px solid var(--fg);
}
.btn-primary:hover { background: #d1d1d6; border-color: #d1d1d6; }

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--muted);
}
.btn-secondary:hover { border-color: var(--secondary); }

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: 980px;
  margin: 0 auto;
}

/* ── SECTION LABELS — Apple uses small, medium-weight eyebrows ── */
.section-label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 48px;
}

/* ── PROJECTS ── */

.project:last-of-type { border-bottom: 1px solid var(--border); }
.project:hover { background: rgba(255, 255, 255, 0.03); }

/* ── PROJECTS CAROUSEL ── */
.projects-carousel {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding-bottom: 32px;
  scroll-snap-type: x mandatory; 
  scroll-behavior: smooth;
  
  /* ADD THIS: Tells the browser to snap to the start of the content */
  scroll-padding-left: 20px; 
  
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.projects-carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* ── PROJECT CARD ── */
.project-card {
  /* calc: 100% width, minus the two 24px gaps, divided by 3 items */
  flex: 0 0 calc((100% - 48px) / 3); 
  scroll-snap-align: start;
  
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden; /* Keeps the image inside the rounded corners */
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px); /* Slight lift effect */
}

/* Image Wrapper */
.proj-image {
  width: 100%;
  aspect-ratio: 16 / 9; /* Standard widescreen ratio */
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

.proj-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures the image fills the space without stretching */
}

/* Card Content */
.proj-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Pushes tags to the bottom if text lengths vary */
}

.proj-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.proj-content h3 {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 8px;
}

.proj-content p {
  font-size: 15px;
  color: var(--secondary);
  line-height: 1.5;
  margin-bottom: 24px;
  flex-grow: 1;
}

/* Tag Pills */
.proj-topics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.proj-topics span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 980px; /* Pill shape */
  border: 1px solid var(--border);
}

/* ── RESPONSIVE TWEAKS ── */
@media (max-width: 900px) {
  /* Show 2 items at a time on tablets */
  .project-card {
    flex: 0 0 calc((100% - 24px) / 2);
  }
}

@media (max-width: 640px) {
  /* Show 1 item at a time on phones */
  .project-card {
    flex: 0 0 calc(100% - 20px);
  }
}

/* ── CONTACT ── */
/* Large statement email à la Apple product callouts */
.contact-email {
  display: block;
  font-family: var(--sans);
  font-size: clamp(28px, 4.5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.2s;
}
.contact-email:hover { color: var(--secondary); }

.contact-note {
  font-size: 17px;
  color: var(--secondary);
  letter-spacing: -0.01em;
  margin-bottom: 48px;
}

.contact-socials { display: flex; gap: 28px; flex-wrap: wrap; }
.contact-socials a {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  letter-spacing: -0.01em;
  transition: border-color 0.2s, color 0.2s;
}
.contact-socials a:hover { border-color: var(--fg); color: var(--fg); }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--secondary);
  letter-spacing: -0.01em;
}

/* ── SCROLL-REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  nav { padding: 0 20px; }
  
  /* Show the hamburger icon */
  .hamburger { display: block; }
  
  /* Transform the socials into a dropdown */
  .nav-socials { 
    display: none; /* Hidden by default */
    flex-direction: column; 
    position: absolute;
    top: 40px; 
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    min-width: 140px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }

  /* Applied via JS to open the menu */
  .nav-socials.active { display: flex; }

  section { padding: 64px 20px; }
  footer { padding: 20px; flex-direction: column; gap: 8px; align-items: flex-start; }
  .project { grid-template-columns: 32px 1fr; }
  .proj-tag { display: none; }
  .hero-bio { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── CAROUSEL WRAPPER & BUTTONS ── */
.carousel-wrapper {
  position: relative;
  /* Ensure arrows don't cause horizontal page scrolling if they slightly overlap the edges */
  width: 100%; 
  /* Add this to create breathing room below your Projects header */
  margin-top: 48px;
}

.carousel-btn {
  position: absolute;
  top: calc(50% - 16px); /* Centers vertically, accounting for bottom padding */
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  
  /* Frosted glass effect to match the navbar */
  background: rgba(25, 25, 25, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  color: var(--fg);
  
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-btn:hover {
  background: rgba(45, 45, 45, 0.8);
  transform: translateY(-50%) scale(1.05); /* Slight grow effect */
  border-color: rgba(255, 255, 255, 0.2);
}

.carousel-btn:active {
  transform: translateY(-50%) scale(0.95); /* Slight shrink on click */
}

/* Position them slightly outside the inner container */
.carousel-btn.prev { left: -24px; }
.carousel-btn.next { right: -24px; }

/* ── RESPONSIVE TWEAK ── */
@media (max-width: 640px) {
  /* Hide the desktop arrows on mobile, as touch-swiping is more natural */
  .carousel-btn { display: none; }
  
  /* Remove the negative margins so the cards touch the edges correctly */
  .projects-carousel {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }
}