/* CSS Custom Properties for Easy Theme Changes */
:root {
  /* Light Theme Colors */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #64748b;
  --accent-color: #06b6d4;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-alt: #f1f5f9;
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, 'Courier New', monospace;
  
  /* Spacing */
  --container-max-width: 1200px;
  --section-padding: 5rem 0;
  --nav-height: 70px;
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  --primary-color: #60a5fa;
  --primary-hover: #3b82f6;
  --secondary-color: #94a3b8;
  --accent-color: #22d3ee;
  
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-alt: #334155;
  
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-color: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  padding: var(--section-padding);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1.125rem;
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.bg-alt {
  background-color: var(--bg-alt);
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--bg-primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: var(--transition);
}

.nav-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--nav-height);
}

.nav-logo a {
  text-decoration: none;
  color: inherit;
}

.nav-logo a:hover,
.nav-logo a:focus,
.nav-logo a:active,
.nav-logo a:visited {
  text-decoration: none;
  color: inherit;
}

.nav-logo span {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.nav-menu {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
}

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

.nav-link:hover::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.bar {
  width: 25px;
  height: 3px;
  background-color: var(--text-secondary);
  margin: 3px 0;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  padding: calc(var(--nav-height) + 3rem) 0 5rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.1;
}

.highlight {
  color: var(--primary-color);
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
}

.profile-picture {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  animation: float 6s ease-in-out infinite;
  box-shadow: var(--shadow-lg);
  border: 4px solid var(--bg-secondary);
}

.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--primary-color);
}

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

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.5rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  border: 3px solid var(--bg-primary);
}

.timeline-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.timeline-content h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

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

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.skill-category {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: 1rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.skill-category:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.skill-category h3 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  font-size: 1.25rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-tag {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.skill-tag:hover {
  background-color: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

/* Projects */
.projects-grid {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  padding: 1rem 0 2rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-secondary);
  cursor: grab;
  user-select: none;
}

.projects-grid.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.projects-grid.dragging .project-card {
  pointer-events: none;
}

.projects-grid::-webkit-scrollbar {
  height: 8px;
}

.projects-grid::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.projects-grid::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.projects-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.project-card {
  background-color: var(--bg-secondary);
  border-radius: 1rem;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  min-width: 300px;
  max-width: 300px;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  height: 440px;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.project-image {
  height: 150px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-image svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.project-content {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-content p {
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  line-height: 1.4;
  font-size: 0.85rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.4rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.tech-tag {
  background-color: var(--bg-primary);
  color: var(--primary-color);
  padding: 0.15rem 0.5rem;
  border-radius: 0.8rem;
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid var(--primary-color);
  white-space: nowrap;
}

.project-links {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.project-link:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

/* Books */
.books-grid {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  padding: 1rem 0 2rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-secondary);
  cursor: grab;
  user-select: none;
}

.books-grid.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.books-grid.dragging .book-card {
  pointer-events: none;
}

.books-grid::-webkit-scrollbar {
  height: 8px;
}

.books-grid::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.books-grid::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.books-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.book-card {
  background-color: var(--bg-secondary);
  border-radius: 1rem;
  padding: 2rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  text-align: center;
  min-width: 300px;
  max-width: 300px;
  width: 300px;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  height: 400px;
}

.book-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.book-cover {
  width: 100px;
  height: 130px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  margin: 0 auto 1.5rem;
  position: relative;
  overflow: hidden;
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.5rem;
}

.book-cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  border-radius: 0.5rem;
}

.book-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.book-author {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-style: italic;
}

.book-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  white-space: normal;
  flex-grow: 1;
}

.book-rating {
  color: #fbbf24;
  margin-top: auto;
}

.book-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1rem;
  transition: var(--transition);
}

.book-link:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

/* Contact */
.contact-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
}

.contact-item i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.contact-item h3 {
  margin-bottom: 0.25rem;
}

.contact-item a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

.contact-item a:hover {
  color: var(--primary-hover);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 50%;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.social-link:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
}

/* Footer */
.footer {
  background-color: var(--bg-secondary);
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.footer p {
  color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    left: -100%;
    top: var(--nav-height);
    flex-direction: column;
    background-color: var(--bg-primary);
    width: 100%;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-item {
    margin: 1rem 0;
  }

  .hamburger {
    display: flex;
  }

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

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-title {
    font-size: 2.5rem;
  }

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

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

  .book-card {
    min-width: 280px;
    max-width: 280px;
    width: 280px;
    padding: 1.8rem;
    height: 420px;
  }

  .book-cover {
    width: 85px;
    height: 110px;
    margin-bottom: 1.2rem;
  }

  .book-description {
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 0.8rem;
  }

  .book-info h3 {
    word-wrap: break-word;
    line-height: 1.3;
    margin-bottom: 0.4rem;
  }

  .book-author {
    margin-bottom: 0.8rem;
  }

  .book-rating {
    margin-top: 0.5rem;
  }

  .project-card {
    min-width: 250px;
    max-width: 250px;
  }

  .project-content {
    padding: 1rem;
  }

  .books-grid,
  .projects-grid {
    gap: 1.5rem;
  }

  .hero-buttons {
    justify-content: center;
  }

  .profile-picture {
    width: 250px;
    height: 250px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }

  .book-card {
    min-width: 260px;
    max-width: 260px;
    width: 260px;
    padding: 1.5rem;
    height: 400px;
  }

  .book-cover {
    width: 80px;
    height: 105px;
    margin-bottom: 1rem;
  }

  .book-description {
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    margin-bottom: 0.6rem;
  }

  .book-info h3 {
    font-size: 1rem;
    line-height: 1.2;
    word-wrap: break-word;
    margin-bottom: 0.4rem;
  }

  .book-author {
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
  }

  .book-rating {
    margin-top: 0.4rem;
  }

  .project-card {
    min-width: 200px;
    max-width: 200px;
    height: 400px;
  }

  .project-content {
    padding: 0.8rem;
  }

  .project-content h3 {
    font-size: 1rem;
  }

  .project-content p {
    font-size: 0.8rem;
  }

  .tech-tag {
    padding: 0.1rem 0.4rem;
    font-size: 0.6rem;
  }

  .books-grid,
  .projects-grid {
    gap: 1rem;
    padding: 0.5rem 0 1.5rem;
  }

  .book-cover {
    width: 75px;
    height: 100px;
    margin-bottom: 1rem;
  }

  .project-image {
    height: 120px;
  }

  .project-image svg {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 360px) {
  .book-card {
    min-width: 240px;
    max-width: 240px;
    width: 240px;
    padding: 1.2rem;
    height: 380px;
  }

  .project-card {
    min-width: 180px;
    max-width: 180px;
    height: 360px;
  }

  .project-content {
    padding: 0.7rem;
  }

  .project-content h3 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }

  .project-content p {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 0.6rem;
  }

  .book-cover {
    width: 70px;
    height: 90px;
    margin-bottom: 1rem;
  }

  .book-info h3 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
  }

  .book-description {
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 0.6rem;
  }

  .book-author {
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
  }

  .book-rating {
    margin-top: 0.3rem;
  }

  .project-image {
    height: 100px;
  }

  .project-image svg {
    width: 32px;
    height: 32px;
  }

  .books-grid,
  .projects-grid {
    gap: 0.8rem;
    padding: 0.4rem 0 1.2rem;
  }
}

@media (max-width: 320px) {
  .container {
    padding: 0 0.5rem;
  }

  .book-card {
    min-width: 160px;
    max-width: 160px;
    width: 160px;
    padding: 0.8rem;
  }

  .project-card {
    min-width: 160px;
    max-width: 160px;
    height: 340px;
  }

  .project-content {
    padding: 0.6rem;
  }

  .project-content h3 {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
  }

  .project-content p {
    font-size: 0.7rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
  }

  .book-cover {
    width: 65px;
    height: 85px;
    margin-bottom: 0.8rem;
  }

  .book-info h3 {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
  }

  .book-description {
    font-size: 0.7rem;
    line-height: 1.2;
    margin-bottom: 0.6rem;
  }

  .book-author {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
  }

  .project-image {
    height: 80px;
  }

  .project-image svg {
    width: 28px;
    height: 28px;
  }

  .tech-tag {
    padding: 0.05rem 0.3rem;
    font-size: 0.55rem;
    border-radius: 0.5rem;
  }

  .project-links {
    gap: 0.3rem;
  }

  .project-link {
    font-size: 0.65rem;
    gap: 0.2rem;
  }

  .books-grid,
  .projects-grid {
    gap: 0.6rem;
    padding: 0.3rem 0 1rem;
  }

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

  .section-subtitle {
    font-size: 0.85rem;
  }
}
