/**
 * Navigation Header Component Styles
 * Mobile-first responsive design with 768px breakpoint
 * Self-contained, can be dropped into any page
 */

/* ===== TOP NAVIGATION BAR ===== */
.top-nav {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: #f8f8f6;
  border-bottom: 1px solid #e8e8e4;
  flex-shrink: 0;
  gap: 1.5rem;
  position: relative;
  z-index: 1000; /* Always on top, even above welcome overlays */
  min-height: 64px; /* Fixed height for consistency across all pages */
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: 2rem;
  transition: opacity 0.3s;
}

.site-logo:hover {
  opacity: 0.7;
}

.site-logo picture {
  display: flex;
  align-items: center;
}

.site-logo img {
  display: block;
  width: 32px;
  height: 32px;
}

/* ===== DESKTOP NAVIGATION ===== */
.nav-links {
  display: flex;
  gap: 0;
  align-items: center;
  flex: 1;
}

.nav-links a {
  padding: 0.75rem 1.25rem;
  color: #7a7a76;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s;
  border-radius: 2px;
  position: relative;
}

/* Single pipes: Paintings | Writing | ... then Work (before double divider) */
.nav-links a:nth-child(1)::before,
.nav-links a:nth-child(2)::before {
  content: '';
  position: absolute;
  right: -0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: #e8e8e4;
  z-index: 1;
}

/* Single pipes: Constellation | Feed | Shop */
.nav-links a:nth-child(5)::before,
.nav-links a:nth-child(6)::before {
  content: '';
  position: absolute;
  right: -0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: #e8e8e4;
  z-index: 1;
}

.nav-links a:hover {
  color: #2a2a28;
  background: #eeeeea;
}

/* Active state - black background with white text */
.nav-links a.active {
  background: #1a1a18;
  color: #ffffff;
  box-shadow: inset 0 -2px 0 0 rgba(20, 184, 166, 0.6),
              0 4px 12px rgba(0,0,0,0.15);
}

.nav-links a.active::after {
  /* Disable hover underline for active links */
  display: none;
}

/* Hover underline animation */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #14b8a6;
  transform: scaleX(0);
  transition: transform 0.3s;
}

.nav-links a:not(.active):hover::after {
  transform: scaleX(1);
}

/* Double divider between primary and secondary nav */
.nav-divider {
  position: relative;
  width: 4px;
  height: 24px;
  margin: 0 0.5rem;
  flex-shrink: 0;
}

.nav-divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 24px;
  background: #e8e8e4;
}

.nav-divider::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 1px;
  height: 24px;
  background: #e8e8e4;
}

/* ===== UTILITY BUTTONS (Desktop) ===== */
.nav-secondary {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-secondary button {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 1px solid #e8e8e4;
  color: #7a7a76;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.3s;
  font-family: inherit;
}

.nav-secondary button:hover {
  background: #1a1a18;
  color: #ffffff;
  border-color: #1a1a18;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ===== MOBILE HAMBURGER BUTTON ===== */
.hamburger-btn {
  display: none; /* Hidden on desktop */
  width: 48px;
  height: 48px;
  background: transparent;
  border: 1px solid #e8e8e4;
  border-radius: 2px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: auto;
  transition: all 0.3s;
}

.hamburger-btn:hover {
  background: #eeeeea;
  border-color: #d4d4d0;
}

.hamburger-btn span {
  width: 24px;
  height: 2px;
  background: #2a2a28;
  transition: all 0.3s;
  display: block;
}

/* Animated X when active */
.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ===== MOBILE MENU OVERLAY ===== */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 24, 0.98);
  backdrop-filter: blur(20px);
  z-index: 1000;
  
  /* Always rendered, positioned off-screen */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  overflow-y: auto;
  
  /* Slide in from left */
  transform: translateX(-100%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  pointer-events: none; /* Don't block clicks when hidden */
}

.mobile-menu.visible {
  /* Slide into view */
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto; /* Enable clicks when visible */
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  max-width: 500px;
  padding-top: 3rem; /* Extra space at top to prevent cutoff */
}

.mobile-menu a,
.mobile-menu button {
  all: unset;
  display: block;
  padding: 0.6rem 2rem;
  font-size: 1.3rem;
  color: #b8b8b6;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 2px;
  min-height: 44px; /* Touch target size */
  line-height: 1.1;
}

.mobile-menu a:hover,
.mobile-menu button:hover {
  color: #ffffff;
  background: rgba(248, 248, 246, 0.05);
}

.mobile-menu a.active {
  color: #ffffff;
  background: rgba(20, 184, 166, 0.3);
}

.mobile-menu hr {
  border: none;
  height: 1px;
  background: rgba(248, 248, 246, 0.1);
  margin: 1rem 0;
}

.mobile-menu .menu-secondary {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-menu .menu-secondary button {
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  color: #7a7a76;
}

/* ===== CONTACT MODAL ===== */
.contact-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  
  /* Always rendered, positioned off-screen */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Start below viewport */
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  pointer-events: none; /* Don't block clicks when hidden */
}

.contact-modal-overlay.visible {
  /* Slide up into view */
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto; /* Enable clicks when visible */
}

.contact-modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 4px;
  padding: 3rem 3.5rem;
  max-width: 540px;
  width: 90%;
  box-shadow: 0 40px 100px rgba(0,0,0,0.5);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-modal-overlay.visible .contact-modal {
  transform: scale(1);
}

.contact-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(122, 122, 118, 0.1);
  border: none;
  font-size: 1.75rem;
  color: #7a7a76;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}

.contact-modal-close:hover {
  background: rgba(122, 122, 118, 0.2);
  color: #2a2a28;
  transform: scale(1.1);
}

.contact-modal h2 {
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: #2a2a28;
}

.contact-modal .subtitle {
  font-size: 0.95rem;
  color: #7a7a76;
  margin-bottom: 2rem;
  font-style: italic;
}

.contact-modal .contact-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.contact-modal .contact-item {
  font-size: 1rem;
  color: #4a4a48;
  line-height: 1.6;
}

.contact-modal .contact-item strong {
  color: #2a2a28;
  font-weight: 500;
}

.contact-modal .contact-item a {
  color: #14b8a6;
  text-decoration: none;
  transition: color 0.2s;
}

.contact-modal .contact-item a:hover {
  color: #0d9488;
  text-decoration: underline;
}

.contact-modal .cv-downloads {
  display: flex;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(42, 42, 40, 0.1);
}

.contact-modal .cv-download-btn {
  flex: 1;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  display: block;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.contact-modal .cv-download-btn:hover {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.4);
}

/* ===== PROJECTS MODAL ===== */
.projectsnow-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  
  /* Always rendered, positioned off-screen */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Start below viewport */
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  pointer-events: none; /* Don't block clicks when hidden */
}

.projectsnow-modal-overlay.visible {
  /* Slide up into view */
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto; /* Enable clicks when visible */
}

.projectsnow-modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 4px;
  padding: 3rem 3.5rem;
  max-width: 900px;
  width: 90%;
  box-shadow: 0 40px 100px rgba(0,0,0,0.5);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.projectsnow-modal-overlay.visible .projectsnow-modal {
  transform: scale(1);
}

.projectsnow-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(122, 122, 118, 0.1);
  border: none;
  font-size: 1.75rem;
  color: #7a7a76;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}

.projectsnow-modal-close:hover {
  background: rgba(122, 122, 118, 0.2);
  color: #2a2a28;
  transform: scale(1.1);
}

.projectsnow-modal h2 {
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: #2a2a28;
}

.projectsnow-modal .subtitle {
  font-size: 0.95rem;
  color: #7a7a76;
  margin-bottom: 2.5rem;
}

.projectsnow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 1.5rem;
  justify-content: center;
}

.project-card {
  background: #f8f8f6;
  border: 1px solid rgba(42, 42, 40, 0.1);
  border-radius: 3px;
  padding: 2rem 1.75rem;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-card:hover {
  background: #1a1a18;
  color: #ffffff;
  border-color: #1a1a18;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.project-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.project-card-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}

.project-card-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4a4a48;
  margin: 0;
}

.project-card:hover .project-card-desc {
  color: rgba(255, 255, 255, 0.8);
}

/* ===== TABLET RESPONSIVE (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Prevent button overflow on iPad */
  .nav-secondary button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
  
  /* Slightly reduce nav link padding */
  .nav-links a {
    padding: 0.75rem 1rem;
  }
}

/* ===== MOBILE RESPONSIVE (< 768px) ===== */
@media (max-width: 768px) {
  .top-nav {
    padding: 0.75rem 1rem;
  }

  .site-logo {
    margin-right: 1rem;
  }

  /* Hide desktop navigation on mobile */
  .nav-links,
  .nav-secondary {
    display: none;
  }

  /* Show hamburger on mobile */
  .hamburger-btn {
    display: flex;
  }

  /* Mobile modals - slide up from bottom */
  .contact-modal {
    padding: 2rem 1.75rem;
    width: 95%;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
  }

  .contact-modal-overlay.visible .contact-modal {
    transform: translateY(0);
  }

  .contact-modal h2 {
    font-size: 1.5rem;
    padding-right: 3rem; /* Space for X button */
  }

  .contact-modal .cv-downloads {
    flex-direction: column;
  }

  /* Swipe indicator for mobile modals */
  .contact-modal::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(122, 122, 118, 0.3);
    border-radius: 2px;
  }

  .projectsnow-modal {
    padding: 2rem 1.75rem;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    transform: translateY(100%);
  }

  .projectsnow-modal-overlay.visible .projectsnow-modal {
    transform: translateY(0);
  }

  .projectsnow-modal h2 {
    font-size: 1.5rem;
    padding-right: 3rem;
  }

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

  .project-card {
    padding: 1.5rem;
  }

  /* Swipe indicator for projects modal */
  .projectsnow-modal::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(122, 122, 118, 0.3);
    border-radius: 2px;
  }

  /* Larger close buttons on mobile */
  .contact-modal-close,
  .projectsnow-modal-close {
    width: 48px;
    height: 48px;
    font-size: 2rem;
    background: rgba(122, 122, 118, 0.15);
  }
}
