/*
 * Modern Hero Section Styles
 * Kinetic background with magnetic buttons
 */

.hero-modern {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 130px;
  background: var(--bg-primary);
}

/* Kinetic Background Canvas */
.hero-kinetic-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Gradient Overlay */
.hero-gradient-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--bg-primary) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Hero Container */
.hero-modern-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

@media (min-width: 1024px) {
  .hero-modern-container {
    position: relative;
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 600px;
  }
}

/* Content Section */
.hero-content-modern {
  background: var(--bg-primary);
  padding: var(--space-2xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

[data-theme="dark"] .hero-content-modern {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Desktop: Extended envelope layout */
@media (min-width: 1024px) {
  .hero-content-modern {
    position: relative;
    z-index: 5;
    width: 65%;
    min-height: 550px;
    padding: var(--space-3xl);
    padding-right: var(--space-4xl);
    border-radius: 30px;
    margin-right: -10%;
    border: 2px solid rgba(0, 112, 187, 0.08);
  }

  [data-theme="dark"] .hero-content-modern {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.12);
  }

  .hero-description-modern {
    max-width: 550px;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-blue-light);
  opacity: 0.1;
  border: 1px solid var(--accent-blue);
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: var(--space-lg);
  animation: fadeIn 0.8s ease-out 0.5s backwards;
}

[data-theme="dark"] .hero-badge {
  background: rgba(0, 112, 187, 0.15);
  border-color: rgba(0, 112, 187, 0.3);
}

.hero-badge svg {
  width: 16px;
  height: 16px;
}

.hero-title-modern {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  margin-top: 0;
  white-space: nowrap;
  animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.hero-title-modern .gradient-text {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle-modern {
  font-size: clamp(1rem, 1.8vw, 1.375rem);
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: var(--space-md);
  white-space: nowrap;
  animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.hero-description-modern {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  animation: fadeInUp 0.8s ease-out 0.5s backwards;
}

/* Magnetic Buttons */
.hero-buttons-modern {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: 0;
  animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.btn-magnetic {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  border: none;
}

.btn-magnetic-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 112, 187, 0.3);
}

[data-theme="dark"] .btn-magnetic-primary {
  background: linear-gradient(135deg, var(--accent-blue-light) 0%, var(--accent-blue) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(51, 153, 221, 0.3);
}

.btn-magnetic-primary:hover {
  color: white;
  box-shadow: 0 6px 25px rgba(0, 112, 187, 0.5);
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-magnetic-primary:hover {
  color: white;
  box-shadow: 0 6px 25px rgba(51, 153, 221, 0.5);
}

.btn-magnetic-secondary {
  background: transparent;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
}

[data-theme="dark"] .btn-magnetic-secondary {
  color: var(--accent-blue-light);
  border-color: var(--accent-blue-light);
}

.btn-magnetic-secondary:hover {
  background: rgba(0, 112, 187, 0.1);
  box-shadow: 0 4px 20px rgba(0, 112, 187, 0.3);
  transform: translateY(-2px);
}

/* Focus States (Accessibility) */
.btn-magnetic-primary:focus-visible,
.btn-magnetic-secondary:focus-visible {
  outline: 3px solid var(--accent-blue-light);
  outline-offset: 3px;
}

/* Active/Pressed State */
.btn-magnetic-primary:active,
.btn-magnetic-secondary:active {
  transform: translateY(0);
}


/* Stats Section */
.hero-stats {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  animation: fadeInUp 0.8s ease-out 0.7s backwards;
}

.hero-stats-avatars {
  display: flex;
  margin-left: calc(-1 * var(--space-sm));
}

.hero-stats-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--bg-primary);
  background: linear-gradient(135deg, var(--accent-blue-light), var(--accent-blue));
  margin-left: calc(-1 * var(--space-sm));
}

.hero-stats-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.hero-stats-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Logo Section */
.hero-logo-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInRight 1s ease-out 0.5s backwards;
}

/* Desktop: Absolute positioning for overlap effect */
@media (min-width: 1024px) {
  .hero-logo-section {
    position: absolute;
    top: 50px;
    right: var(--space-xl);
    width: 45%;
    max-width: 500px;
    z-index: 10;
  }
}

.hero-logo-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1;
  overflow: visible; /* Allow scaled content to be visible */
}

/* Bento Grid Logo Wrapper */

.hero-logo-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  grid-template-rows: 1fr 1.2fr 1fr;
  gap: 10px; /* Reduced from 12px for more box space */
  background: linear-gradient(135deg, rgba(0, 112, 187, 0.15) 0%, rgba(0, 90, 153, 0.1) 100%);
  border-radius: 30px;
  border: 1px solid rgba(0, 112, 187, 0.2);
  backdrop-filter: blur(10px);
  padding: var(--space-xl);
  overflow: hidden;
}

[data-theme="dark"] .hero-logo-wrapper {
  background: linear-gradient(135deg, rgba(0, 112, 187, 0.25) 0%, rgba(0, 90, 153, 0.2) 100%);
  border-color: rgba(51, 153, 221, 0.3);
}

/* Desktop: Add elevation shadow for floating effect */
@media (min-width: 1024px) {
  .hero-logo-wrapper {
    box-shadow: 0 8px 32px rgba(0, 112, 187, 0.2);
  }

  [data-theme="dark"] .hero-logo-wrapper {
    box-shadow: 0 8px 32px rgba(0, 112, 187, 0.4);
  }
}

/* Bento Box Base Styles */
.bento-box {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  padding: var(--space-sm); /* Reduced from --space-md for more text space */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 112, 187, 0.1);
  overflow: hidden; /* Prevent text overflow from stretching boxes */
}

[data-theme="dark"] .bento-box {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Logo Box (Center) */
.bento-box-logo {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  background: rgba(255, 255, 255, 1);
  padding: var(--space-lg);
}

[data-theme="dark"] .bento-box-logo {
  background: rgba(255, 255, 255, 0.2);
}

.bento-box-logo img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

/* Wide Bento Box - Spans 2 columns */
.bento-box-wide {
  grid-column: span 2;
}

/* Text Styling with Blue Gradient - Variable Sizing Container */
.bento-box-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em; /* Reduced from 0.375em for tighter text packing */
  line-height: 1.1; /* Unified with individual word classes for space efficiency */
  text-transform: lowercase;
  justify-content: center;
}

/* Three-Tier Word Hierarchy System */

/* Primary Words - Key concepts and important nouns */
.word-primary {
  font-size: clamp(0.875rem, 0.8rem + 0.375vw, 1.25rem); /* 14px-20px: ultra-compact for box fit */
  font-weight: 700; /* Increased from 600 to maintain hierarchy at smaller size */
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Secondary Words - Action verbs and modifiers */
.word-secondary {
  font-size: clamp(0.75rem, 0.64rem + 0.3125vw, 1rem); /* 12px-16px: compact sizing */
  font-weight: 600; /* Increased from 500 to maintain hierarchy */
  line-height: 1.1;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tertiary Words - Articles, conjunctions, and connectors */
.word-tertiary {
  font-size: clamp(0.625rem, 0.555rem + 0.1875vw, 0.8125rem); /* 10px-13px: minimal viable size */
  font-weight: 500; /* Increased from 400 for better readability at small size */
  line-height: 1.1;
  letter-spacing: 0.01em; /* Added slight spacing for readability */
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* Hover Effect (subtle) */
.bento-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 112, 187, 0.15);
}

[data-theme="dark"] .bento-box:hover {
  box-shadow: 0 4px 12px rgba(51, 153, 221, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

/* Logo box no hover effect */
.bento-box-logo:hover {
  transform: none;
  box-shadow: none;
}

/* Scroll Indicator */
.hero-scroll-indicator {
  position: absolute;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-secondary);
  opacity: 0;
  animation: fadeInUp 1s ease-out 1.2s forwards;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hero-scroll-indicator:hover {
  color: var(--accent-blue);
  transform: translateX(-50%) translateY(-5px);
}

.hero-scroll-indicator span {
  display: none;
}

.hero-scroll-line {
  width: 2px;
  height: 100px;
  background: linear-gradient(to bottom, var(--accent-blue) 0%, transparent 100%);
  position: relative;
  overflow: hidden;
}

.hero-scroll-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: linear-gradient(to bottom, var(--accent-blue-light) 0%, var(--accent-blue) 100%);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0% {
    transform: translateY(-50px);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100px);
    opacity: 0;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}


/* ============================================
   BENTO GRID RESPONSIVE SCALING
   Perfect proportional scaling on mobile using transform
   ============================================ */

/* CSS Custom Properties for Responsive Scaling */
:root {
  --bento-base-size: 500px; /* Base desktop size */
  --bento-mobile-padding: var(--space-md); /* Mobile container padding */
  --bento-tablet-padding: var(--space-lg); /* Tablet container padding */
}

/* Mobile: Transform scale approach for proportional scaling */
@media (max-width: 767px) {
  /* Container for scaled bento grid */
  .hero-logo-container {
    /* Match width of hero-content-modern container on mobile */
    width: 100%;
    max-width: 100%; /* Allow full width */
    height: auto; /* Let height adjust based on scaled content */
  }

  /* Bento grid wrapper - keep desktop layout but scale it down */
  .hero-logo-wrapper {
    /* Keep original desktop grid structure */
    grid-template-columns: 1fr 1.2fr 1fr;
    grid-template-rows: 1fr 1.2fr 1fr;
    gap: 10px;
    padding: var(--space-xl);

    /* Set to base size for consistent scaling */
    width: var(--bento-base-size);
    height: var(--bento-base-size);

    /* Calculate scale to fill full container width */
    --scale-factor: calc((100vw - (2 * var(--bento-mobile-padding))) / var(--bento-base-size));
    transform: scale(var(--scale-factor));
    transform-origin: top left; /* Scale from top-left instead of center */

    /* Position to fill width */
    margin-left: 0;
    margin-right: 0;

    /* Smooth scaling transitions */
    transition: transform 0.3s ease;
  }

  /* Ensure bento boxes maintain desktop structure */
  .bento-box-logo {
    grid-column: 2 / 3; /* Center position like desktop */
    grid-row: 2 / 3;
  }

  .bento-box-wide {
    grid-column: span 2; /* Keep 2-column span like desktop */
  }

  /* Text keeps desktop sizing - will scale with transform */
  .bento-box-text .word-primary,
  .bento-box-text .word-secondary,
  .bento-box-text .word-tertiary {
    /* Reset any responsive font sizing - use desktop values */
    font-size: inherit;
  }

  /* Ensure flip animations work with scaled grid */
  .flip-container {
    /* Maintain 3D context during scaling */
    perspective: calc(1000px * var(--scale-factor));
  }

  /* Disable hover transform on scaled mobile grid to prevent layout shifts */
  .bento-box:hover {
    transform: none; /* Override desktop hover effect */
  }
}

/* Tablet: Slightly scale for better fit */
@media (max-width: 1023px) and (min-width: 768px) {
  .hero-logo-wrapper {
    /* Keep desktop structure with moderate scaling */
    --bento-tablet-size: 450px;
    width: var(--bento-tablet-size);
    height: var(--bento-tablet-size);
    --scale-factor: calc(min(100vw - (2 * var(--bento-tablet-padding)), 600px) / var(--bento-tablet-size));
    transform: scale(var(--scale-factor));
    transform-origin: top center;
    transition: transform 0.3s ease;
  }

  /* Adjust flip perspective for tablet */
  .flip-container {
    perspective: calc(1000px * var(--scale-factor));
  }
}

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

  .bento-box {
    transition: none;
  }

  .bento-box:hover {
    transform: none;
  }

  /* Keep transform scale but remove transition */
  .hero-logo-wrapper {
    transition: none !important;
  }
}

/* Tablet: Revert to stacked layout */
@media (max-width: 1023px) and (min-width: 768px) {
  .hero-content-modern {
    width: 100% !important;
    margin-right: 0 !important;
    min-height: auto !important;
    border-radius: 30px;
  }

  .hero-logo-section {
    position: relative !important;
    top: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin-top: var(--space-2xl);
  }
}

/* Mobile Adjustments - Nested Layout */
@media (max-width: 768px) {
  .hero-modern {
    min-height: auto;
    height: auto;
    padding-top: var(--space-xl);
    padding-bottom: var(--space-2xl);
    align-items: flex-start;
  }

  .hero-modern-container {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    position: relative;
  }

  /* White container extends to top */
  .hero-content-modern {
    padding: var(--space-lg);
    padding-top: var(--space-2xl); /* Extra top padding for name */
    width: 100%;
    margin-right: 0;
    min-height: auto;
    border-radius: 30px;
    order: 1;
    position: relative;
    /* Create enough space for bento grid + subtitle to fit visually inside */
    /* Calculation: bento top + bento height + spacing + subtitle height buffer */
    padding-bottom: calc(var(--space-2xl) + 3rem + var(--bento-base-size) * 0.55 + var(--space-3xl) + 3rem);
  }

  /* Name at the top */
  .hero-title-modern {
    margin-bottom: var(--space-md);
    text-align: center;
  }

  /* Bento grid - visually moved inside white container */
  .hero-logo-section {
    order: 2;
    position: absolute;
    top: calc(var(--space-2xl) + 3rem); /* Position below name, inside white box */
    left: 50%;
    transform: translateX(-50%); /* Perfect centering regardless of scaled content size */
    width: calc(var(--bento-base-size) * var(--bento-mobile-scale)); /* Match scaled visual width */
    padding: 0;
    z-index: 10; /* Above white container background */
    animation: fadeIn 1s ease-out 0.5s backwards; /* Simple fade-in, no movement on mobile */
  }

  /* Scale down the bento grid to fit */
  .hero-logo-container {
    width: 100%;
    --bento-mobile-scale: 0.55; /* 55% scale for mobile */
    padding: 0;
    margin: 0 auto;
    overflow: visible; /* Allow flip animations */
  }

  .hero-logo-wrapper {
    --scale-factor: var(--bento-mobile-scale);
    transform-origin: top center;
    /* Compensate for scaled size with negative margin */
    margin-bottom: calc((var(--bento-mobile-scale) - 1) * var(--bento-base-size));
  }

  /* Titles below bento grid - must fit on one line */
  .hero-subtitle-modern {
    /* Push down to appear below bento grid */
    /* Calculation: bento top offset + bento scaled height + spacing (reduced by 0.5rem to compensate for line-height) */
    margin-top: calc(var(--space-2xl) + 3rem + var(--bento-base-size) * 0.55 + 0.5rem);
    margin-bottom: var(--space-md);
    /* Force single line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    text-align: center;
  }

  /* Description */
  .hero-description-modern {
    margin-bottom: var(--space-lg);
    text-align: center;
  }

  /* Buttons */
  .hero-buttons-modern {
    flex-direction: column;
  }

  .btn-magnetic {
    width: 100%;
    justify-content: center;
  }

  .hero-scroll-indicator {
    display: none;
  }
}

/* Very small screens - allow text to wrap if needed */
@media (max-width: 480px) {
  .hero-title-modern {
    white-space: normal;
  }

  .hero-subtitle-modern {
    white-space: normal;
  }

  .hero-content-modern {
    padding: var(--space-md);
  }
}
