/**
 * Shared Styles for Portfolio Website
 * Common styles used across all pages
 */

/* Base Styles */
body {
  font-family: 'Roboto', sans-serif;
}

/* Ensure content sits below the fixed nav */
main {
  padding-top: 4rem;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 1s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

/* Mobile menu styles */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.mobile-menu.active {
  max-height: 500px;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
  a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Loading Spinner */
.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Card Hover Effects */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Filter Button Styles */
.filter-btn {
  background-color: #f9fafb;
  color: #4b5563;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #4f46e5 100%);
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

/* Utility Classes */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Focus Styles for Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Skip to Content Link (for accessibility) */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #3b82f6;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* Print Styles */
@media print {
  nav,
  footer,
  .no-print {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  a {
    text-decoration: underline;
  }

  main {
    padding-top: 0;
  }
}

/* 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;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   Blog Post Page Specific Styles
   ======================================== */

/* Reading Progress Bar */
#reading-progress {
  transition: width 0.1s ease-out;
}

/* Article Prose Styling */
.prose {
  color: #374151;
  line-height: 1.75;
}

.prose h2 {
  color: #1f2937;
  font-weight: 700;
  font-size: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.prose h3 {
  color: #1f2937;
  font-weight: 600;
  font-size: 1.375rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.prose p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.prose ul,
.prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.prose strong {
  font-weight: 600;
  color: #1f2937;
}

.prose a {
  color: #3b82f6;
  text-decoration: underline;
  transition: color 0.2s;
}

.prose a:hover {
  color: #2563eb;
}

/* Search Term Highlighting */
mark {
  background-color: #fef08a;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

/* Smooth Scrolling with Offset for Fixed Header */
html {
  scroll-padding-top: 100px;
}

/* Sticky Sidebar Elements */
@media (min-width: 1024px) {
  .sticky-sidebar {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }
}

/* Table of Contents Active Link */
.toc-link {
  transition: color 0.2s, font-weight 0.2s;
}

.toc-link.active {
  color: #3b82f6;
  font-weight: 600;
}

/* Active Filter Tags Animation */
.filter-tag {
  animation: fadeIn 0.3s ease-out;
}

/* Social Share Button Styles */
@media (max-width: 1023px) {
  .social-sidebar {
    display: none !important;
  }

  .social-mobile {
    display: flex !important;
  }

  /* Add spacing between "Share this article:" text and buttons on mobile */
  .social-mobile p {
    margin-bottom: 1rem;
  }
}

@media (min-width: 1024px) {
  .social-sidebar {
    display: flex !important;
  }

  .social-mobile {
    display: none !important;
  }
}

/* Related Post Cards */
.related-post-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post-card:hover {
  transform: translateY(-4px);
}

/* Blog Card Hover Effect */
.blog-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
}

/* Print Styles for Blog Posts */
@media print {
  #reading-progress,
  #social-sidebar,
  #social-mobile-top,
  #social-mobile-bottom,
  #related-posts,
  #prev-post,
  #next-post,
  #toc-container {
    display: none !important;
  }

  .prose {
    max-width: 100%;
  }

  /* Ensure article content is visible */
  #article-content {
    display: block !important;
  }
}

/* Mobile Menu Show Class */
.mobile-menu.show {
  max-height: 500px;
}

/* Ensure line clamp works correctly */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
