/**
 * Components Stylesheet
 * 
 * Contains styles for specific UI components including:
 * - Navigation menu (hamburger menu with hover expansion)
 * - Hero section (homepage landing)
 * - Footer (frosted glass effect)
 * - Content pages (typography and layout)
 * - Animations (keyframes and transitions)
 * 
 * All components use the design system variables from main.css
 * and support both dark and light themes.
 * 
 * @fileoverview Component-specific styles for nmokey.com
 */

/* ============================================
   HAMBURGER MENU - Floating Hover Menu
   ============================================ */

.menu-toggle {
  position: fixed;
  top: var(--space-6);
  right: calc(var(--space-6) + 60px); /* Position next to theme toggle (or home button) */
  width: 56px;
  height: 56px;
  z-index: calc(var(--z-menu) + 10);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent; /* Let menu handle background */
  border: none;
  padding: 0;
  overflow: visible; /* Allow menu to extend beyond */
}

/* Home button is now on the left, so no adjustment needed */

.menu-toggle:hover .nav-menu,
.nav-menu:hover {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: all;
  width: 200px; /* Fixed width to prevent collapse */
  height: auto;
  min-width: 200px; /* Prevent collapse when moving between items */
  border-radius: var(--radius-md);
  padding: var(--space-2);
  padding-bottom: var(--space-4); /* Add bottom padding to prevent collapse */
  display: block;
  overflow: visible;
}

/* Hide icon when menu is visible */
.menu-toggle:hover .menu-icon {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

.menu-icon {
  position: absolute;
  transition: opacity var(--transition-base), transform var(--transition-base);
  z-index: 1;
}

.menu-icon {
  width: 24px;
  height: 24px;
  position: relative;
  transform: rotate(0deg);
  transition: transform var(--transition-base);
}

.menu-icon span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: var(--radius-full);
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: all var(--transition-base);
}

/* Icon rotation removed - menu replaces icon instead */

.menu-icon span:nth-child(1) {
  top: 6px;
}

.menu-icon span:nth-child(2) {
  top: 11px;
}

.menu-icon span:nth-child(3) {
  top: 16px;
}

/* Icon X animation removed - menu replaces icon instead */

/* ============================================
   NAVIGATION MENU - Grows from Icon
   ============================================ */

.nav-menu {
  position: absolute;
  top: 0; /* Replace the icon position */
  right: 0;
  background: rgba(30, 41, 59, 0.15); /* Very transparent dark background for frosted glass */
  backdrop-filter: blur(4px) saturate(180%);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  border: 2px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  box-shadow: var(--shadow-xl);
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.3);
  transform-origin: top right; /* Grow from top-right corner */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-radius 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Smooth border-radius transition */
  pointer-events: none;
  white-space: nowrap;
  /* Start as circle matching icon */
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  /* Maintain minimum width to prevent collapse */
  min-width: 56px;
}

/* Light mode frosted glass */
[data-theme="light"] .nav-menu {
  background: rgba(255, 255, 255, 0.2); /* Very transparent white for light mode */
  border: 2px solid rgba(0, 0, 0, 0.1); /* Subtle border for light mode */
}

.nav-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  opacity: 0;
  transition: opacity var(--transition-base) 0.1s;
}

.menu-toggle:hover .nav-menu ul,
.nav-menu:hover ul {
  opacity: 1;
}

.nav-menu li {
  margin-bottom: var(--space-1);
}

.nav-menu > ul > li {
  position: relative; /* For submenu positioning */
}

.nav-menu > ul > li:not(:last-child) {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}

.nav-menu a {
  display: block;
  padding: var(--space-2) var(--space-3); /* Reduced padding */
  color: var(--color-text);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm); /* Less rounded */
  transition: all var(--transition-base);
  position: relative;
}

/* Left-justify the about link (first item) */
.nav-menu > ul > li:first-child a {
  text-align: left;
  padding-left: var(--space-3);
}

.nav-menu > ul > li:first-child a:hover {
  padding-left: var(--space-3); /* Keep left-justified on hover */
}

.nav-menu a:hover {
  background: var(--color-bg-hover);
  color: var(--color-primary);
  padding-left: var(--space-4);
  text-decoration: none;
}

.nav-menu a.current {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

.nav-menu a.current::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Dropdown submenu */
.nav-menu .submenu {
  margin-top: var(--space-1);
  margin-left: 0; /* Full width */
  margin-right: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out; /* Faster, smoother transition */
  width: 100%; /* Span full width */
  display: block;
}

.nav-menu li:hover .submenu {
  max-height: 500px;
}

.nav-menu .submenu li {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  width: 100%; /* Full width */
}

.nav-menu .submenu a {
  font-size: var(--text-xs);
  font-weight: var(--font-normal);
  color: var(--color-text-light);
  padding: var(--space-2) var(--space-3); /* Full width padding */
  display: block;
  width: 100%; /* Span full width */
}

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

.nav-menu .submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-menu .submenu-toggle::after {
  content: '▼';
  font-size: var(--text-xs);
  transition: transform var(--transition-base);
}

.nav-menu li:hover .submenu-toggle::after {
  transform: rotate(180deg);
}

/* ============================================
   HERO SECTION - Landing Page
   ============================================ */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh; /* Full viewport height to hide content below */
  text-align: center;
  padding: var(--space-16) var(--space-6);
  position: relative;
  z-index: 2;
}

.hero-name {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: var(--font-bold);
  line-height: 1.1;
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
  position: relative;
  display: inline-block;
}

.hero-name::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transform: scaleX(0);
  animation: expandLine 1s ease-out 0.5s forwards;
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-light);
  margin-bottom: var(--space-8);
  animation: fadeInUp 0.8s ease-out 0.2s both;
  max-width: 600px;
  min-height: 1.5em; /* Prevent layout shift */
}

.cycling-text {
  display: inline-block;
  position: relative;
  color: var(--color-primary);
  font-weight: var(--font-medium);
  min-width: 200px;
  text-align: center;
}

.cycling-text::after {
  content: '|';
  animation: blink 1s infinite;
  margin-left: 2px;
  color: var(--color-primary);
}

/* Typewriter effect - no fade classes needed */

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* Remove underline animation from hero buttons */
.hero-actions .btn::after,
.hero-actions .btn:hover::after {
  display: none;
}

/* Hero button styles - frosted glass with no border */
.hero-actions .btn {
  border: none; /* Remove border */
  background: rgba(96, 165, 250, 0.2); /* Blue-tinted frosted glass for resume button */
  backdrop-filter: blur(4px) saturate(180%);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  color: var(--color-text);
}

.hero-actions .btn:hover {
  background: rgba(96, 165, 250, 0.3); /* Slightly more opaque blue on hover */
  border: none; /* Ensure no border on hover */
}

/* Light mode blue-tinted frosted glass for resume button */
[data-theme="light"] .hero-actions .btn {
  background: rgba(37, 99, 235, 0.2); /* Blue-tinted frosted glass for light mode */
}

[data-theme="light"] .hero-actions .btn:hover {
  background: rgba(37, 99, 235, 0.3); /* Slightly more opaque blue on hover */
}

/* About button - mostly clear frosted glass */
.hero-actions .btn-secondary {
  border: none; /* Remove border */
  background: rgba(30, 41, 59, 0.1); /* Very transparent, mostly clear */
  backdrop-filter: blur(4px) saturate(180%);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  color: var(--color-text);
}

.hero-actions .btn-secondary:hover {
  background: rgba(30, 41, 59, 0.15); /* Slightly more visible on hover */
  border: none; /* Ensure no border on hover */
}

/* Light mode mostly clear frosted glass for about button */
[data-theme="light"] .hero-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.15); /* Very transparent white for light mode */
}

[data-theme="light"] .hero-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2); /* Slightly more visible on hover */
}

.hero-image {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin: var(--space-8) auto;
  border: 4px solid var(--color-primary);
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 1s ease-out 0.6s both;
  transition: transform var(--transition-base);
}

.hero-image:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl);
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes expandLine {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

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

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  padding: var(--space-12) 0;
  margin-top: var(--space-16);
  background: rgba(30, 41, 59, 0.15); /* Very transparent dark background for frosted glass */
  backdrop-filter: blur(4px) saturate(180%);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  position: relative;
  z-index: 1;
}

/* Light mode frosted glass */
[data-theme="light"] .site-footer {
  background: rgba(255, 255, 255, 0.2); /* Very transparent white for light mode */
  border-top: 1px solid rgba(0, 0, 0, 0.1); /* Subtle border for light mode */
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.footer-col h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-col a {
  color: var(--color-text-light);
  transition: color var(--transition-base);
}

.footer-col a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ============================================
   CONTENT PAGES
   ============================================ */

.page-content h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-8);
  text-align: left;
}

.page-content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-border);
}

.page-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.page-content ul,
.page-content ol {
  margin-bottom: var(--space-6);
}

.page-content li {
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
  transition: all var(--transition-base);
}

.page-content li:hover {
  padding-left: var(--space-4);
  color: var(--color-primary);
}

.page-content a {
  position: relative;
  transition: all var(--transition-base);
}

.page-content a:hover {
  text-decoration: none;
}

.page-content a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--transition-base);
}

.page-content a:hover::after {
  width: 100%;
}

.page-content img {
  margin: var(--space-8) auto;
  max-width: 100%;
}

.page-content iframe {
  width: 100%;
  max-width: 560px;
  height: 315px;
  border-radius: var(--radius-lg);
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-md);
}

/* ============================================
   PAGE NAVIGATION - Right Side Navigation
   ============================================ */

.page-nav {
  position: fixed;
  top: calc(var(--space-6) + 56px + var(--space-2)); /* Below theme toggle and menu */
  right: var(--space-6);
  z-index: var(--z-menu);
  display: flex;
  align-items: flex-start;
  height: auto;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: visible;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.page-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1); /* Minimal spacing */
  position: relative;
  padding-right: var(--space-3);
}

/* Vertical line */
.page-nav-list::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
  opacity: 0.5;
  transition: opacity var(--transition-base);
}

.page-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.page-nav-link {
  color: var(--color-text-lighter);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 400;
  text-align: right;
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
  transform-origin: right center;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: none; /* Allow full text to show */
}

/* Hover state */
.page-nav-link:hover {
  color: var(--color-text-light);
  transform: translateX(-2px);
}

/* Active state - expanding text */
.page-nav-item.active .page-nav-link {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  transform: translateX(-4px) scale(1.05);
}

/* Light mode adjustments */
[data-theme="light"] .page-nav-list::before {
  background: var(--color-border);
  opacity: 0.3;
}

[data-theme="light"] .page-nav-link {
  color: var(--color-text-lighter);
}

[data-theme="light"] .page-nav-link:hover {
  color: var(--color-text);
}

[data-theme="light"] .page-nav-item.active .page-nav-link {
  color: var(--color-primary);
}

/* Content sections styling */
.content-sections {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-16) var(--space-6);
}

.content-section,
.content-subsection {
  margin-bottom: var(--space-16);
  scroll-margin-top: 120px; /* Offset for fixed navigation */
}

.content-section h1,
.content-section h2,
.content-subsection h2 {
  margin-bottom: var(--space-6);
  color: var(--color-text);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
}

.content-section h2 .date-range,
.content-subsection h2 .date-range {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--color-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.content-subsection {
  margin-left: 0;
  margin-top: var(--space-8);
}

/* Publications hanging indent */
#publications p {
  text-indent: -2em;
  padding-left: 2em;
  margin-bottom: var(--space-4);
}

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

@media screen and (max-width: 768px) {
  .menu-toggle {
    width: 48px;
    height: 48px;
    top: var(--space-4);
    right: calc(var(--space-4) + 52px);
  }
  
  .nav-menu {
    top: calc(var(--space-4) + 56px);
    right: var(--space-4);
    min-width: 180px;
  }
  
  .hero {
    min-height: 70vh;
    padding: var(--space-12) var(--space-4);
  }
  
  .hero-name {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }
  
  .hero-subtitle {
    font-size: var(--text-lg);
  }
  
  .hero-image {
    width: 150px;
    height: 150px;
  }

  /* Hide page navigation on mobile */
  .page-nav {
    display: none;
  }

  .content-sections {
    padding: var(--space-12) var(--space-4);
  }

  .content-subsection {
    margin-left: 0;
  }
}

@media screen and (max-width: 1200px) {
  /* Adjust page navigation position on smaller screens */
  .page-nav {
    right: var(--space-4);
  }
}
