/**
 * Ultimate Refinements - 10+ Improvements for Premium Appearance
 * Focus: Typography, spacing, colors, micro-interactions, accessibility
 */

/* ========================================
   1. TYPOGRAPHY IMPROVEMENTS
   ======================================== */

/* Better line height and letter spacing for readability */
body {
  line-height: 1.7;
  letter-spacing: 0.01em;
}

h1 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h2 {
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

h3 {
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

p {
  line-height: 1.75;
  margin-bottom: var(--spacing-md);
}

/* Improved text hierarchy */
.hero-tagline {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

.hero-description {
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.8;
  color: var(--color-text-muted);
  max-width: 65ch;
}

/* ========================================
   2. BUTTON REFINEMENTS
   ======================================== */

.button,
button {
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.button:hover,
button:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(96, 165, 250, 0.5);
  letter-spacing: 0.03em;
}

.button:active,
button:active {
  transform: translateY(0) scale(0.98);
}

/* ========================================
   3. CARD CONSISTENCY
   ======================================== */

.item,
.resume-card {
  border-radius: var(--radius-large);
  background: linear-gradient(
    145deg,
    var(--color-surface) 0%,
    rgba(11, 17, 32, 0.95) 100%
  );
  border: 1px solid rgba(96, 165, 250, 0.12);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.item:hover,
.resume-card:hover {
  border-color: rgba(96, 165, 250, 0.25);
  background: linear-gradient(
    145deg,
    var(--color-surface) 0%,
    rgba(15, 23, 42, 0.98) 100%
  );
}

/* ========================================
   4. ENHANCED FOCUS STATES (Accessibility)
   ======================================== */

a:focus-visible,
button:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 6px;
  box-shadow:
    0 0 0 6px rgba(96, 165, 250, 0.15),
    0 4px 12px rgba(96, 165, 250, 0.3);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 4px rgba(96, 165, 250, 0.1),
    0 2px 8px rgba(96, 165, 250, 0.2);
}

/* ========================================
   5. NAVIGATION ENHANCEMENTS
   ======================================== */

.nav {
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  background: rgba(11, 17, 32, 0.92) !important;
  border: 1px solid rgba(96, 165, 250, 0.15);
  box-shadow:
    0 8px 32px rgba(2, 6, 23, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(96, 165, 250, 0.1);
  transition: all 0.3s ease;
}

.nav a {
  transition: all 0.25s ease;
  position: relative;
}

.nav a:hover {
  color: var(--color-accent);
  text-shadow: 0 0 12px rgba(96, 165, 250, 0.4);
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  transition: transform 0.3s ease;
}

.nav a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* ========================================
   6. HERO SECTION COLOR REFINEMENTS
   ======================================== */

.hero-badge {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.12),
    rgba(139, 92, 246, 0.1)
  );
  border: 1px solid rgba(96, 165, 250, 0.25);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(191, 219, 254, 0.95);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hero-badge:hover {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.18),
    rgba(139, 92, 246, 0.15)
  );
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow:
    0 8px 20px rgba(37, 99, 235, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ========================================
   7. HERO STATS VISUAL HIERARCHY
   ======================================== */

.hero-stats {
  gap: var(--spacing-md);
}

.hero-stats li {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.09),
    rgba(139, 92, 246, 0.07)
  );
  border: 1px solid rgba(96, 165, 250, 0.18);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-large);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 4px 12px rgba(2, 6, 23, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-stats li:hover {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.15),
    rgba(139, 92, 246, 0.12)
  );
  border-color: rgba(96, 165, 250, 0.35);
  transform: translateY(-3px);
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(96, 165, 250, 0.2);
}

.hero-stats strong {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.hero-stats span {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ========================================
   8. SMOOTHER MICRO-INTERACTIONS
   ======================================== */

/* Smooth hover transitions for all interactive elements */
a, button, .button, .item, .resume-card, .hero-stats li {
  will-change: transform;
}

/* Refined link hover */
a:not(.button):not(.nav a) {
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease,
    text-shadow 0.2s ease;
}

a:not(.button):not(.nav a):hover {
  color: var(--color-accent);
  text-decoration-color: rgba(96, 165, 250, 0.5);
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
}

/* Smooth scale on interactive icons */
.hero-social li a i {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-social li a:hover i {
  transform: scale(1.1);
}

/* ========================================
   9. IMAGE OPTIMIZATIONS
   ======================================== */

img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  filter: brightness(0.98) contrast(1.02);
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.5s ease;
}

.item:hover img,
.resume-card:hover img {
  filter: brightness(1) contrast(1.05);
  transform: scale(1.015);
}

/* Lazy loading optimization */
img[loading="lazy"] {
  opacity: 0;
  animation: fadeInImage 0.6s ease forwards;
}

@keyframes fadeInImage {
  to {
    opacity: 1;
  }
}

/* ========================================
   10. SECTION SPACING & VISUAL RHYTHM
   ======================================== */

section {
  padding: clamp(3rem, 8vw, 6rem) 0;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

section:first-of-type {
  padding-top: clamp(2rem, 5vw, 4rem);
}

/* Improved section header spacing */
section > h2 {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  padding-bottom: var(--spacing-sm);
}

section > h2::after {
  margin-top: var(--spacing-xs);
}

/* ========================================
   11. AWARD BADGE REFINEMENTS
   ======================================== */

.award-badge {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.11),
    rgba(139, 92, 246, 0.09)
  );
  border: 1px solid rgba(96, 165, 250, 0.22);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-medium);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.award-badge:hover {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.16),
    rgba(139, 92, 246, 0.13)
  );
  border-color: rgba(96, 165, 250, 0.38);
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(37, 99, 235, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(96, 165, 250, 0.15);
}

/* ========================================
   12. FOOTER REFINEMENTS
   ======================================== */

footer {
  background: linear-gradient(
    180deg,
    var(--color-background) 0%,
    rgba(6, 10, 20, 0.98) 100%
  );
  border-top: 1px solid rgba(96, 165, 250, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(96, 165, 250, 0.06),
    0 -8px 24px rgba(2, 6, 23, 0.2);
  padding: clamp(2rem, 5vw, 3rem) 0;
}

footer a {
  transition: all 0.25s ease;
}

footer a:hover {
  color: var(--color-accent);
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.35);
}

/* ========================================
   13. LIGHT THEME ADJUSTMENTS
   ======================================== */

html[data-theme="light"] .item,
html[data-theme="light"] .resume-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .item:hover,
html[data-theme="light"] .resume-card:hover {
  border-color: rgba(59, 130, 246, 0.25);
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(59, 130, 246, 0.15);
}

html[data-theme="light"] .nav {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow:
    0 8px 32px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ========================================
   REDUCED MOTION OVERRIDES
   ======================================== */

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

  img {
    animation: none !important;
  }
}

/* ========================================
   HERO LAYOUT OPTIMIZATIONS
   ======================================== */

/* Compact hero section to fit all content without scrolling */
header.site-hero {
  min-height: min(96vh, 900px) !important;
  padding: clamp(1.25rem, 2.5vw, 2rem) 0 clamp(0.75rem, 2vw, 1.25rem) !important;
}

.hero-grid {
  margin-top: clamp(0.5rem, 1.5vw, 1rem) !important;
  gap: clamp(0.75rem, 2vw, 1.25rem) !important;
}

.hero-content,
.hero-copy {
  gap: clamp(0.5rem, 1.25vw, 0.75rem) !important;
}

.hero-tagline {
  margin-bottom: 0.35rem !important;
}

.hero-description {
  margin-bottom: 0.5rem !important;
}

.hero-social {
  margin: 0.25rem 0 0 0 !important;
}

.hero-stats {
  margin-top: clamp(0.35rem, 0.75vw, 0.5rem) !important;
  gap: clamp(0.35rem, 0.75vw, 0.5rem) !important;
}

.hero-stats li {
  padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.5rem, 1.25vw, 0.75rem) !important;
  min-height: 85px !important;
}

.hero-stats strong,
.stat-number {
  font-size: clamp(1.85rem, 4vw, 2.5rem) !important;
  margin-bottom: 0.1rem !important;
}

.hero-stats span,
.stat-label {
  font-size: 0.8rem !important;
}

/* More compact portrait card */
.portrait-card {
  max-width: 300px !important;
}

/* Tighter hero badge */
.hero-badge {
  padding: 0.35rem 0.9rem !important;
  font-size: 0.68rem !important;
  margin-bottom: 0.35rem !important;
}

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

@media (max-width: 768px) {
  /* CRITICAL: Prevent hero parallax from causing content displacement */
  header.site-hero {
    transform: none !important;
    overflow: visible !important;
    padding-top: 5rem !important; /* Extra padding for fixed mobile menu button */
    padding-bottom: 2rem !important;
    min-height: 0 !important; /* Allow natural height on mobile */
  }

  /* Better mobile typography */
  body {
    line-height: 1.65;
  }

  h1 {
    line-height: 1.2;
  }

  /* Ensure h1 name is always visible on mobile */
  .hero-copy h1,
  .hero-content h1 {
    font-size: clamp(2.2rem, 9vw, 2.8rem) !important;
    color: #f8fafc !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
  }

  /* More compact spacing on mobile */
  section {
    padding: clamp(2rem, 6vw, 4rem) 0;
  }

  /* Mobile hero optimizations - ensure everything fits */
  .hero-grid {
    gap: clamp(0.75rem, 2vw, 1rem) !important;
    margin-top: clamp(0.5rem, 1.5vw, 1rem) !important;
  }

  .hero-copy,
  .hero-content {
    gap: clamp(0.5rem, 1.5vw, 0.75rem) !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .hero-tagline {
    margin-bottom: 0.4rem !important;
  }

  .hero-description {
    margin-bottom: 0.6rem !important;
    font-size: clamp(0.95rem, 3vw, 1.05rem) !important;
  }

  /* Ensure social buttons are always visible */
  .hero-social {
    margin: 0.5rem 0 0 0 !important;
    position: relative !important;
    z-index: 10 !important;
  }

  .hero-social li a {
    width: 42px !important;
    height: 42px !important;
    font-size: 1.1rem !important;
  }

  /* Mobile hero stats */
  .hero-stats {
    gap: clamp(0.5rem, 1.5vw, 0.75rem) !important;
    margin-top: clamp(0.5rem, 1.5vw, 0.75rem) !important;
  }

  .hero-stats li {
    padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem) !important;
    min-height: 90px !important;
  }

  .hero-stats strong,
  .stat-number {
    font-size: clamp(2rem, 5vw, 2.5rem) !important;
  }

  .hero-stats span,
  .stat-label {
    font-size: 0.85rem !important;
  }

  /* Portrait card mobile sizing */
  .portrait-card {
    max-width: 280px !important;
    margin: 0 auto !important;
  }

  /* Hero badge mobile */
  .hero-badge {
    font-size: 0.7rem !important;
    padding: 0.4rem 1rem !important;
    margin-bottom: 0.75rem !important;
  }

  /* Better mobile hero title spacing */
  .hero-copy h1,
  .hero-content h1 {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
  }

  /* Reduce transforms on mobile for performance */
  .item:hover,
  .resume-card:hover,
  .button:hover,
  .hero-stats li:hover {
    transform: translateY(-1px) !important;
  }

  /* Mobile navigation improvements */
  .nav {
    max-height: calc(100vh - 8rem) !important;
  }

  .nav a {
    padding: 0.9rem 1.2rem !important;
    font-size: 1rem !important;
  }

  /* Disable complex effects on mobile for better performance */
  .item::before,
  .item::after,
  .resume-card::before,
  .resume-card::after {
    display: none !important;
  }

  /* Simpler hover effects on mobile */
  .item:hover,
  .resume-card:hover {
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.15) !important;
  }

  /* Better touch targets */
  button,
  .button,
  a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Extra small mobile devices */
@media (max-width: 520px) {
  /* Single column stats */
  .hero-stats {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .hero-stats li {
    min-height: 80px !important;
  }

  /* Smaller portrait on very small screens */
  .portrait-card {
    max-width: 240px !important;
  }

  /* Compact social buttons */
  .hero-social li a {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
  }

  /* Tighter carousel controls */
  .quote-slider__controls {
    gap: 0.4rem !important;
  }

  .quote-slider__arrow {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
  }

  .quote-slider__dots {
    padding: 0.15rem 0.35rem !important;
    gap: 0.25rem !important;
  }

  .quote-slider__dot {
    width: 5px !important;
    height: 5px !important;
  }
}
