/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: white;
  background-color: #212121;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-display: swap;
}

img {
  max-width: 100%;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 100;
  font-weight: bold;
}

.skip-link:focus {
  top: 6px;
}

/* Focus styles */
*:focus {
  outline: 2px solid #d26249;
  outline-offset: 2px;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: #212121;
  height: 64px;
  display: flex;
  align-items: center;
}

.navbar-container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
}

.burger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: white;
}

.burger-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.burger-btn:focus {
  background-color: rgba(255, 255, 255, 0.1);
}

.burger-icon {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.burger-btn[aria-expanded="true"] .burger-icon {
  transform: rotate(90deg) scale(1.1);
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: white;
}

.social-icons a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.desktop-only {
  display: flex;
}

.mobile-only {
  display: none;
}

/* Mobile Navbar */
@media (max-width: 768px) {
  .navbar {
    top: auto;
    bottom: 0;
    border-top: 1px solid #303030;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: flex;
  }

  .social-icons {
    gap: 8px;
  }

  .social-icons a {
    width: 36px;
    height: 36px;
  }

  .social-icons svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 350px) {
  .navbar-container {
    padding: 0 8px;
  }
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu.open {
  display: block;
  opacity: 1;
  visibility: visible;
}

.mobile-menu-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(33, 33, 33, 0.8);
  backdrop-filter: blur(4px);
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 384px;
  background-color: #212121;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px;
  transform: translateX(-100%);
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

.mobile-menu.open .mobile-menu-content {
  transform: translateX(0);
}

.close-btn {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: white;
  padding-left: 0.55rem;
  padding-bottom: 0.2rem;
}

.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.close-btn svg {
  width: 24px;
  height: 24px;
}

@media (min-width: 769px) {
  .close-btn {
    top: 16px;
    bottom: auto;
    right: 16px;
    left: auto;
    padding-left: 0;
    padding-bottom: 0;
  }
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 48px;
}

.mobile-nav-link {
  font-size: 32px;
  font-weight: 300;
  color: white;
  transition: all 0.3s ease;
  padding: 8px 16px;
  border-radius: 8px;
  opacity: 0;
  transform: translateX(-25px) translateY(40px) scale(0.9);
  animation: menuItemSlideIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.mobile-nav-link:nth-child(1) { animation-delay: 0.25s; }
.mobile-nav-link:nth-child(2) { animation-delay: 0.37s; }
.mobile-nav-link:nth-child(3) { animation-delay: 0.49s; }

.mobile-nav-link:hover {
  color: #ccc;
  transform: scale(1.05) translateX(8px);
}

.mobile-nav-link.active {
  color: white;
}

.mobile-social-icons {
  display: flex;
  gap: 24px;
  opacity: 0;
  transform: translateY(35px) scale(0.95);
  animation: socialIconsSlideIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) 0.61s forwards;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.mobile-social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transition: all 0.3s ease;
  color: white;
  opacity: 0;
  animation: socialIconItemSlideIn 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.mobile-social-icons a:nth-child(1) { animation-delay: 0.73s; }
.mobile-social-icons a:nth-child(2) { animation-delay: 0.79s; }
.mobile-social-icons a:nth-child(3) { animation-delay: 0.85s; }
.mobile-social-icons a:nth-child(4) { animation-delay: 0.91s; }

.mobile-social-icons a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.2);
}

/* Animations */
@keyframes menuItemSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-25px) translateY(40px) scale(0.9);
  }
  40% {
    opacity: 0.6;
    transform: translateX(8px) translateY(10px) scale(1.02);
  }
  70% {
    opacity: 0.9;
    transform: translateX(-2px) translateY(-3px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

@keyframes socialIconsSlideIn {
  0% {
    opacity: 0;
    transform: translateY(35px) scale(0.95);
  }
  50% {
    opacity: 0.7;
    transform: translateY(10px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes socialIconItemSlideIn {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-180deg);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1) rotate(-90deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Main Content */
.main-content {
  padding-bottom: 64px;
}

@media (min-width: 769px) {
  .main-content {
    padding-top: 64px;
    padding-bottom: 0;
  }
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 24px 16px 0;
}

@media (min-width: 640px) {
  .hero-section {
    padding: 48px 16px 0;
  }
}

@media (min-width: 769px) {
  .hero-section {
    padding: 40px 16px 0;
  }
}

.logo-hero {
  margin: 0 auto 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
}

@media (min-width: 640px) {
  .logo-hero {
    margin-bottom: 32px;
  }
}

.hero-image {
  max-width: 1024px;
  margin: 0 auto 16px;
  padding: 0 8px;
}

@media (min-width: 640px) {
  .hero-image {
    margin-bottom: 32px;
    padding: 0 16px;
  }
}

.hero-image img {
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
  aspect-ratio: 4/3;
}

/* Content Sections */
.content-section {
  max-width: 1024px;
  margin: 0 auto;
  padding: 32px 8px;
}

@media (min-width: 640px) {
  .content-section {
    padding: 48px 16px;
  }
}

.hero-title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 32px;
  text-align: center;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 48px;
    margin-bottom: 32px;
  }
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 96px;
  }
}

.hero-description {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 32px;
  color: #e5e5e5; /* Improved contrast from #ccc */
}

@media (min-width: 640px) {
  .hero-description {
    font-size: 18px;
    margin-bottom: 48px;
  }
}

@media (min-width: 768px) {
  .hero-description {
    font-size: 20px;
  }
}

/* Portfolio Preview */
.portfolio-preview {
  background: linear-gradient(135deg, #303030 0%, #404040 100%);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 48px;
  text-align: center;
  border: 1px solid #555;
}

.portfolio-title {
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 16px;
}

.portfolio-description {
  font-size: 16px;
  color: #e5e5e5;
  margin-bottom: 24px;
  line-height: 1.6;
}

.portfolio-button {
  display: inline-block;
  background: #d26249;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 2px solid #d26249;
}

.portfolio-button:hover {
  background: #b8553f;
  border-color: #b8553f;
  transform: translateY(-2px);
}

.portfolio-button:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Section Titles */
.section-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 32px;
  border-bottom: 1px solid #374151;
  padding-bottom: 16px;
}

@media (min-width: 640px) {
  .section-title {
    font-size: 32px;
    margin-bottom: 32px;
    padding-bottom: 16px;
  }
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 640px) {
  .timeline {
    gap: 24px;
  }
}

.timeline-item {
  border-left: 2px solid #d26249;
  padding-left: 12px;
}

@media (min-width: 640px) {
  .timeline-item {
    padding-left: 24px;
  }
}

.timeline-title {
  font-size: 18px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

@media (min-width: 640px) {
  .timeline-title {
    font-size: 20px;
  }
}

.timeline-company {
  font-size: 14px;
  color: #e5e5e5; /* Improved contrast from #ccc */
  margin-bottom: 4px;
}

@media (min-width: 640px) {
  .timeline-company {
    font-size: 16px;
  }
}

.timeline-period {
  font-size: 12px;
  color: #d1d5db; /* Improved contrast from #9ca3af */
}

@media (min-width: 640px) {
  .timeline-period {
    font-size: 14px;
  }
}

/* Lists */
.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 640px) {
  .list {
    gap: 12px;
  }
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  word-break: break-words;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .list-item {
    font-size: 16px;
  }
}

.bullet {
  color: #d26249;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.grid-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  word-break: break-words;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .grid-item {
    font-size: 16px;
  }
}

/* Favorites Grid */
.favorites-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .favorites-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.favorites-item {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.favorites-title {
  font-size: 18px;
  font-weight: 600;
  color: #d26249;
  margin-bottom: 8px;
}

@media (min-width: 640px) {
  .favorites-title {
    font-size: 20px;
  }
}

/* Responsive optimizations */
@media (max-width: 350px) {
  body {
    font-size: 14px;
  }

  .content-section {
    padding: 24px 8px;
  }

  .hero-title {
    font-size: 24px;
  }

  .section-title {
    font-size: 20px;
  }
}

/* Performance optimizations */
* {
  will-change: auto;
}

.navbar,
.mobile-menu-content,
[style*="backgroundColor"] {
  contain: layout style paint;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .mobile-menu-content {
    transition: none;
  }

  .mobile-nav-link,
  .mobile-social-icons,
  .mobile-social-icons a {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
