/* CSS Custom Properties */
:root {
  --primary-teal: #89ECDA;
  --primary-blue: #0080BA;
  --text-dark: #1E1E1E;
  --text-light: #222;
  --bg-light: #F0FFFC;
  --spacing-xs: clamp(8px, 1vw, 12px);
  --spacing-sm: clamp(12px, 2vw, 18px);
  --spacing-md: clamp(18px, 3vw, 24px);
  --spacing-lg: clamp(24px, 4vw, 32px);
  --spacing-xl: clamp(32px, 6vw, 48px);
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  color: var(--text-dark);
  background: #fff;
  overflow-x: hidden;
}

/* Hero Section with Enhanced Animations */
.story-hero {
  position: relative;
  width: 100%;
  height: clamp(700px, 80vh, 800px);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.story-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.story-hero-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(255, 255, 255, 0.9), transparent);
  z-index: 2;
}

.story-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: slowZoom 20s ease-in-out infinite alternate;
}

@keyframes slowZoom {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* Floating Background Elements */
.floating-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.floating-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  z-index: 1;
  opacity: 0;
  animation: float 6s ease-in-out infinite;
}

.circle-1 {
  width: 100px;
  height: 100px;
  top: 20%;
  left: 15%;
  animation-delay: 0s;
}

.circle-2 {
  width: 150px;
  height: 150px;
  top: 40%;
  right: 20%;
  animation-delay: 2s;
}

.circle-3 {
  width: 80px;
  height: 80px;
  bottom: 25%;
  left: 25%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% { 
    transform: translateY(0px) rotate(0deg);
    opacity: 0.3;
  }
  33% { 
    transform: translateY(-20px) rotate(120deg);
    opacity: 0.6;
  }
  66% { 
    transform: translateY(10px) rotate(240deg);
    opacity: 0.4;
  }
}

/* Hero Content - Optimized for top positioning */
.story-hero-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: min(1243px, 90vw);
  margin: 0 auto;
  text-align: center;
  padding: var(--spacing-lg) var(--spacing-md) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
}

.animated-title {
  font-family: 'Kaisei Opti', serif;
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 500;
  margin: 0;
  color: var(--text-dark);
  letter-spacing: 0.5px;
  line-height: 1.1;
  opacity: 1;
}

.story-quote-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.animated-quote {
  font-family: 'Kaisei Opti', serif;
  font-size: clamp(14px, 2vw, 16px);
  font-weight: 400;
  color: var(--text-dark);
  margin: 0;
  quotes: '"' '"';
  line-height: 1.4;
  font-style: italic;
  position: relative;
  opacity: 1;
}

.animated-quote::before {
  content: open-quote;
  font-size: 1.5em;
  color: var(--primary-teal);
  position: absolute;
  left: -0.5em;
  top: -0.2em;
}

.animated-quote::after {
  content: close-quote;
  font-size: 1.5em;
  color: var(--primary-teal);
  position: absolute;
  right: -0.5em;
  bottom: -0.2em;
}

.animated-author {
  font-family: 'Kaisei Opti', serif;
  font-size: clamp(16px, 2.5vw, 22px);
  color: var(--text-dark);
  font-weight: 500;
  margin: 0;
  opacity: 1;
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  z-index: 10;
}

.scroll-arrow {
  width: 40px;
  height: 40px;
  border: 2px solid var(--bg-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-light);
  animation: bounce 2s infinite;
  transition: all 0.3s ease;
}

.scroll-arrow:hover {
  background: var(--primary-teal);
  color: white;
  transform: scale(1.1);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Main Content Section */
.story-main-content {
  background: linear-gradient(135deg, var(--bg-light) 0%, #ffffff 100%);
  padding: clamp(60px, 10vh, 120px) clamp(20px, 8vw, 118px);
  font-size: clamp(16px, 1.5vw, 20px);
  color: var(--text-light);
  line-height: 1.7;
  font-family: 'Poppins', sans-serif;
  position: relative;
}

/* Section Introduction */
.section-intro {
  text-align: center;
  margin-bottom: clamp(60px, 8vh, 100px);
}

.section-title {
  font-family: 'Kaisei Opti', serif;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: var(--spacing-lg);
}

.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
}

.divider-line {
  width: clamp(60px, 15vw, 120px);
  height: 2px;
  background: var(--primary-blue);
  border-radius: 1px;
}

.divider-dot {
  width: 12px;
  height: 12px;
  background: var(--primary-blue);
  border-radius: 50%;
}

/* Enhanced Timeline */
.timeline {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 50%;
  border-left: 3px dotted var(--primary-blue);
  transform: translateX(-50%);
  opacity: 0.6;
}

.timeline-progress {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 50%;
  width: 3px;
  background: rgba(0, 128, 186, 0.2);
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-progress-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(to bottom, var(--primary-teal), var(--primary-blue));
  transition: height 0.3s ease;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: clamp(60px, 8vh, 100px);
  position: relative;
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}

.timeline-item.animate {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-blue));
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 0 8px rgba(137, 236, 218, 0.2);
  transition: all 0.3s ease;
}

.timeline-item.animate::before {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 8px rgba(137, 236, 218, 0.2); }
  50% { box-shadow: 0 0 0 15px rgba(137, 236, 218, 0.1); }
  100% { box-shadow: 0 0 0 8px rgba(137, 236, 218, 0.2); }
}

.timeline-content {
  width: calc(50% - 86px);
  max-width: 654px;
  color: #0A0A0A;
  font-size: clamp(16px, 1.5vw, 16px);
  line-height: 1.6;
  text-align: left;
  position: relative;
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-number {
  position: absolute;
  top: -15px;
  left: var(--spacing-lg);
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-blue));
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Kaisei Opti', serif;
}

.timeline-image {
  width: calc(50% - 86px);
  max-width: 654px;
  position: relative;
}

.image-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.image-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.timeline-image img {
  width: 100%;
  height: 267px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.image-wrapper:hover img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(137, 236, 218, 0.1), rgba(0, 128, 186, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-wrapper:hover .image-overlay {
  opacity: 1;
}

/* Alternating Layout */
.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
}

.timeline-item:nth-child(even) .timeline-content {
  order: 2;
  padding-left: var(--spacing-lg);
}

.timeline-item:nth-child(even) .timeline-image {
  order: 1;
}

.story-cta {
  text-align: center;
  margin-top: clamp(80px, 12vh, 120px);
  padding: clamp(40px, 6vh, 60px);
  background: linear-gradient(135deg, rgba(137, 236, 218, 0.1), rgba(0, 128, 186, 0.1));
  border-radius: 24px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.story-cta h3 {
  font-family: 'Kaisei Opti', serif;
  font-size: clamp(24px, 3vw, 36px);
  color: var(--text-dark);
  margin-bottom: var(--spacing-md);
}

.story-cta p {
  font-size: clamp(16px, 1.5vw, 20px);
  color: var(--text-light);
  margin-bottom: var(--spacing-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* New wrapper: controls gap + centering + responsive wrap */
.cta-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md, 16px);
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm, 8px);
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-blue));
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 128, 186, 0.3);
  min-height: 38px;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 128, 186, 0.4);
}

.cta-button i,
.cta-button .whatsapp-icon {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.cta-button:hover i {
  transform: translateX(5px);
}

/* Stack buttons on very small screens */
@media (max-width: 420px) {
  .cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .cta-button {
    width: 100%;
  }
}

/* Responsive Design */
@media (max-width: 900px) {
  .story-hero {
    height: clamp(400px, 70vh, 500px);
    align-items: flex-start;
  }
  
  .story-hero-content {
    padding-top: var(--spacing-sm);
  }
  
  .floating-circle {
    display: none;
  }
  
  .scroll-indicator {
    bottom: var(--spacing-md);
  }
}

@media (max-width: 992px) {
  .story-main-content {
    padding: clamp(40px, 8vh, 80px) var(--spacing-md);
  }

  .timeline::before {
    left: 13px;
    transform: translateX(0);
  }

  .timeline-progress {
    left: 13px;
    transform: translateX(0);
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    flex-direction: column;
    gap: var(--spacing-lg);
  }

  .timeline-item::before {
    left: 0;
    transform: translate(0, 0);
  }

  .timeline-content,
  .timeline-image {
    width: 100%;
    padding-left: 50px;
    max-width: none;
  }
  
  .timeline-content {
    order: 1;
    padding: var(--spacing-lg);
  }

  .timeline-image {
    order: 2;
  }

  .timeline-image img {
    height: auto;
    min-height: 250px;
  }
}

@media (max-width: 600px) {
  .story-hero {
    height: clamp(280px, 55vh, 350px);
    min-height: 560px;
    margin-top: 10px;
  }
  .story-hero-content {
    max-width: 98vw;
    padding-top: 10px;
  }
  .animated-title {
    font-size: clamp(22px, 7vw, 32px);
    line-height: 1.1;
  }
  .story-quote-container blockquote {
    font-size: 14px;
    padding: 0 4px;
  }
  .animated-author {
    font-size: 15px;
  }
  /* Hide timeline circles and line on mobile */
  .timeline::before,
  .timeline-item::before {
    display: none !important;
  }
}

@media (max-width: 576px) {
  .timeline-content,
  .timeline-image {
    padding-left: 30px;
  }
  
  .timeline-number {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

/* Performance Optimizations */
.timeline-item,
.image-wrapper,
.cta-button,
.floating-circle {
  will-change: transform;
  backface-visibility: hidden;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .floating-circle {
    animation: none;
  }
  
  .scroll-arrow {
    animation: none;
  }
}

/* Print Styles */
@media print {
  .floating-elements,
  .scroll-indicator,
  .story-cta {
    display: none;
  }
  
  .timeline-item {
    break-inside: avoid;
    margin-bottom: 30px;
  }
}
