/*
 * Cohen Gallagher - Space-Themed Personal Website
 * Static HTML/CSS/JS - S3 compatible. No build step required.
 * Theme: space, innovation, creativity. Animations: scroll-triggered, hover, parallax.
 */

/* ==========================================================================
   CSS Custom Properties (Theme Variables)
   ========================================================================== */
:root {
  --color-bg-dark: #0a0a0f;
  --color-bg-section: #0d0d14;
  --color-bg-card: rgba(20, 20, 35, 0.8);
  --color-text: #e8e8f0;
  --color-text-muted: #a0a0b8;
  --color-accent: #6a9bcc;
  --color-accent-glow: rgba(106, 155, 204, 0.4);
  --color-border: rgba(255, 255, 255, 0.08);
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg-dark);
  overflow-x: hidden;
}

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

a:hover {
  color: #8bb8e8;
}

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

ul {
  list-style: none;
}

/* ==========================================================================
   Navigation Bar
   Fixed positioning, semi-transparent background with backdrop-blur.
   Parallax translateY applied via JS based on scroll.
   ========================================================================== */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: transform 0.2s var(--ease-smooth);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.nav-logo:hover {
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

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

/* ==========================================================================
   Hero Section
   Full-viewport space background. Moon and shooting stars layered above.
   Next section (About) has higher z-index so moon "hides behind" on scroll.
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Background image - hero-background.png covers viewport */
.hero-background {
  position: absolute;
  inset: 0;
  background: url('../assets/hero-background.png') center center / cover no-repeat;
  z-index: 0;
}

/* Shooting stars container - positioned above background */
.shooting-stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Individual shooting star - diagonal streak via linear-gradient */
.star {
  position: absolute;
  width: 2px;
  height: 80px;
  background: linear-gradient(
    to bottom right,
    transparent 0%,
    rgba(255, 255, 255, 0.9) 20%,
    rgba(255, 255, 255, 0.9) 40%,
    transparent 100%
  );
  transform: rotate(-45deg);
  opacity: 0;
  animation: shootingStar 4s var(--ease-out-expo) infinite;
}

/* Staggered delays and positions for natural effect */
.star-1 { top: 10%; left: 20%; animation-delay: 0s; }
.star-2 { top: 30%; left: 60%; animation-delay: 1.2s; }
.star-3 { top: 50%; left: 10%; animation-delay: 2.4s; }
.star-4 { top: 70%; left: 80%; animation-delay: 3.6s; }
.star-5 { top: 85%; left: 40%; animation-delay: 4.8s; }

@keyframes shootingStar {
  0% {
    opacity: 0;
    transform: rotate(-45deg) translateX(-100px) translateY(-100px);
  }
  10% {
    opacity: 1;
    transform: rotate(-45deg) translateX(0) translateY(0);
  }
  30% {
    opacity: 0.8;
    transform: rotate(-45deg) translateX(200px) translateY(200px);
  }
  100% {
    opacity: 0;
    transform: rotate(-45deg) translateX(400px) translateY(400px);
  }
}

/* Moon element - planet-moon.png, positioned top-right. Transform (rotate, translateY) driven by JS on scroll */
.moon {
  position: absolute;
  top: 15%;
  right: 10%;
  width: 180px;
  height: 180px;
  background: url('../assets/planet-moon.png') center center / contain no-repeat;
  z-index: 2;
  will-change: transform;
}

/* Hero content - centered text above background */
.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 2rem;
  max-width: 700px;
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.hero-quote {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
  border-left: 3px solid var(--color-accent);
  padding-left: 1.5rem;
  text-align: left;
}

.hero-quote cite {
  display: block;
  font-size: 0.9rem;
  font-style: normal;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* ==========================================================================
   Section Base
   About section has position: relative and z-index so it overlaps moon.
   ========================================================================== */
.section {
  position: relative;
  z-index: 10;
  padding: 5rem 0;
  background: var(--color-bg-section);
}

.section:nth-child(even) {
  background: #0a0a12;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 2.5rem;
  text-align: center;
  color: var(--color-text);
}

/* ==========================================================================
   Reveal Animation
   Elements with .reveal class fade/slide in when scrolled into view.
   JS IntersectionObserver adds .visible class.
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth);
}

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

/* ==========================================================================
   About Section
   Two-column grid: bio left, skill cards right. Stacks on mobile.
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-bio p {
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.about-skills {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Skill cards - hover: subtle scale and border glow */
.skill-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px var(--color-accent-glow);
  border-color: rgba(106, 155, 204, 0.3);
}

.skill-card h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  color: var(--color-accent);
}

.skill-card ul li {
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.skill-card ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* ==========================================================================
   Projects Section
   Card grid with video placeholders. Hover lift effect.
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* Video placeholder - styled box with play icon */
.project-video-placeholder {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9) 0%, rgba(30, 30, 50, 0.9) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.placeholder-icon {
  font-size: 2.5rem;
  color: var(--color-accent);
  opacity: 0.7;
}

.project-content {
  padding: 1.5rem;
}

.project-no-video {
  padding: 1.5rem;
}

.project-content h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.project-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.project-tech {
  font-size: 0.85rem;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.project-link {
  font-size: 0.9rem;
}

/* ==========================================================================
   Experience Section
   Timeline layout with vertical connector.
   ========================================================================== */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

/* Vertical line connecting timeline items */
.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-accent), transparent);
  opacity: 0.5;
}

.timeline-item {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2rem;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 12px var(--color-accent-glow);
}

.timeline-content h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.timeline-content h4 {
  font-size: 1rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.timeline-date {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.timeline-content p,
.timeline-content ul {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.timeline-content p {
  margin-bottom: 0.5rem;
}

.timeline-content ul li {
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}

.timeline-content ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* ==========================================================================
   Contact Section
   Centered links with icons.
   ========================================================================== */
.contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: all 0.3s var(--ease-smooth);
}

.contact-link:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 20px var(--color-accent-glow);
}

.contact-icon {
  font-size: 1.25rem;
  font-weight: 600;
}

/* ==========================================================================
   Footer
   Copyright and resume PDF link.
   ========================================================================== */
.footer {
  padding: 2rem;
  background: #050508;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

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

.footer-resume {
  font-size: 0.95rem;
}

/* ==========================================================================
   Responsive Design
   Breakpoints: 768px, 1024px. Nav stays horizontal if it fits; hamburger optional.
   ========================================================================== */
@media (max-width: 768px) {
  .main-nav {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .nav-logo {
    font-size: 1.25rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.9rem;
  }

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

  .hero-content {
    padding: 1rem;
  }

  .hero-quote {
    font-size: 1.1rem;
    padding-left: 1rem;
  }

  .moon {
    width: 120px;
    height: 120px;
    top: 10%;
    right: 5%;
  }

  .section {
    padding: 3rem 0;
  }

  .container {
    padding: 0 1rem;
  }

  .section-title {
    font-size: 2rem;
  }

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

  .timeline::before {
    left: 8px;
  }

  .timeline-item {
    padding-left: 2rem;
  }

  .timeline-marker {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
