/* Animated Hero Section */
.hero {
  text-align: center;
  margin-bottom: 0;
}

.hero-animated {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  margin: 0;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  overflow: hidden;
}

/* Mobile touch feedback */
@media (hover: none) {
  .age-card-compact:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .quick-generate-btn:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
}

/* Consistent full-screen hero across all devices */
@media (max-width: 768px) {
  .hero-animated {
    margin-left: -var(--space-4);
    margin-right: -var(--space-4);
    width: calc(100% + 2 * var(--space-4));
    max-width: 100vw;
  }
  
  .hero-image {
    object-position: center 30%;
  }
}

@media (max-width: 480px) {
  .hero-animated {
    margin-left: -var(--space-4);
    margin-right: -var(--space-4);
    width: calc(100% + 2 * var(--space-4));
    max-width: 100vw;
  }
}

.hero-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(180deg, var(--color-cream) 0%, rgba(253, 251, 247, 0.9) 50%, rgba(253, 251, 247, 0.3) 80%, transparent 100%);
  z-index: 4;
  pointer-events: none;
}

.hero-animated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(0deg, var(--color-cream) 0%, rgba(253, 251, 247, 0.9) 50%, rgba(253, 251, 247, 0.3) 80%, transparent 100%);
  z-index: 4;
  pointer-events: none;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: heroBreathing 6s ease-in-out infinite;
  filter: brightness(0.95) contrast(1.05) saturate(1.1);
}

.hero-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 2;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    var(--bubble-bg-start, rgba(168, 181, 160, 0.6)) 0%, 
    var(--bubble-bg-mid, rgba(168, 181, 160, 0.3)) 50%, 
    var(--bubble-bg-end, rgba(168, 181, 160, 0.1)) 100%);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--bubble-border, rgba(168, 181, 160, 0.4));
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 0 8px var(--bubble-glow, rgba(168, 181, 160, 0.3));
  animation: gentleFloat 8s ease-in-out infinite;
  will-change: transform, opacity;
  transition: all 0.4s ease;
  opacity: 0.7;
}

.bubble:hover {
  background: linear-gradient(135deg, 
    var(--bubble-bg-start-hover, rgba(168, 181, 160, 0.8)) 0%, 
    var(--bubble-bg-mid-hover, rgba(168, 181, 160, 0.5)) 50%, 
    var(--bubble-bg-end-hover, rgba(168, 181, 160, 0.2)) 100%);
  transform: translateY(-2px) scale(1.05);
}

/* Bubble variants with different colors and sizes */
.bubble-1 {
  width: 40px;
  height: 40px;
  --bubble-bg-start: rgba(26, 84, 144, 0.7);
  --bubble-bg-mid: rgba(26, 84, 144, 0.4);
  --bubble-bg-end: rgba(26, 84, 144, 0.15);
  --bubble-border: rgba(26, 84, 144, 0.5);
  --bubble-glow: rgba(26, 84, 144, 0.4);
  --bubble-bg-start-hover: rgba(26, 84, 144, 0.9);
  --bubble-bg-mid-hover: rgba(26, 84, 144, 0.6);
  --bubble-bg-end-hover: rgba(26, 84, 144, 0.25);
}

.bubble-2 {
  width: 24px;
  height: 24px;
  --bubble-bg-start: rgba(255, 153, 153, 0.7);
  --bubble-bg-mid: rgba(255, 153, 153, 0.4);
  --bubble-bg-end: rgba(255, 153, 153, 0.15);
  --bubble-border: rgba(255, 153, 153, 0.5);
  --bubble-glow: rgba(255, 153, 153, 0.4);
  --bubble-bg-start-hover: rgba(255, 153, 153, 0.9);
  --bubble-bg-mid-hover: rgba(255, 153, 153, 0.6);
  --bubble-bg-end-hover: rgba(255, 153, 153, 0.25);
}

.bubble-3 {
  width: 16px;
  height: 16px;
  --bubble-bg-start: rgba(255, 215, 0, 0.7);
  --bubble-bg-mid: rgba(255, 215, 0, 0.4);
  --bubble-bg-end: rgba(255, 215, 0, 0.15);
  --bubble-border: rgba(255, 215, 0, 0.5);
  --bubble-glow: rgba(255, 215, 0, 0.4);
  --bubble-bg-start-hover: rgba(255, 215, 0, 0.9);
  --bubble-bg-mid-hover: rgba(255, 215, 0, 0.6);
  --bubble-bg-end-hover: rgba(255, 215, 0, 0.25);
}

.bubble-4 {
  width: 32px;
  height: 32px;
  --bubble-bg-start: rgba(74, 144, 226, 0.7);
  --bubble-bg-mid: rgba(74, 144, 226, 0.4);
  --bubble-bg-end: rgba(74, 144, 226, 0.15);
  --bubble-border: rgba(74, 144, 226, 0.5);
  --bubble-glow: rgba(74, 144, 226, 0.4);
  --bubble-bg-start-hover: rgba(74, 144, 226, 0.9);
  --bubble-bg-mid-hover: rgba(74, 144, 226, 0.6);
  --bubble-bg-end-hover: rgba(74, 144, 226, 0.25);
}

.bubble-5 {
  width: 20px;
  height: 20px;
  --bubble-bg-start: rgba(61, 90, 61, 0.7);
  --bubble-bg-mid: rgba(61, 90, 61, 0.4);
  --bubble-bg-end: rgba(61, 90, 61, 0.15);
  --bubble-border: rgba(61, 90, 61, 0.5);
  --bubble-glow: rgba(61, 90, 61, 0.4);
  --bubble-bg-start-hover: rgba(61, 90, 61, 0.9);
  --bubble-bg-mid-hover: rgba(61, 90, 61, 0.6);
  --bubble-bg-end-hover: rgba(61, 90, 61, 0.25);
}

.bubble-6 {
  width: 28px;
  height: 28px;
  --bubble-bg-start: rgba(139, 111, 71, 0.7);
  --bubble-bg-mid: rgba(139, 111, 71, 0.4);
  --bubble-bg-end: rgba(139, 111, 71, 0.15);
  --bubble-border: rgba(139, 111, 71, 0.5);
  --bubble-glow: rgba(139, 111, 71, 0.4);
  --bubble-bg-start-hover: rgba(139, 111, 71, 0.9);
  --bubble-bg-mid-hover: rgba(139, 111, 71, 0.6);
  --bubble-bg-end-hover: rgba(139, 111, 71, 0.25);
}

.bubble-7 {
  width: 14px;
  height: 14px;
  --bubble-bg-start: rgba(212, 184, 150, 0.7);
  --bubble-bg-mid: rgba(212, 184, 150, 0.4);
  --bubble-bg-end: rgba(212, 184, 150, 0.15);
  --bubble-border: rgba(212, 184, 150, 0.5);
  --bubble-glow: rgba(212, 184, 150, 0.4);
  --bubble-bg-start-hover: rgba(212, 184, 150, 0.9);
  --bubble-bg-mid-hover: rgba(212, 184, 150, 0.6);
  --bubble-bg-end-hover: rgba(212, 184, 150, 0.25);
}

/* Additional bubbles for fuller coverage */
.bubble-8 {
  width: 22px;
  height: 22px;
  --bubble-bg-start: rgba(165, 196, 212, 0.7);
  --bubble-bg-mid: rgba(165, 196, 212, 0.4);
  --bubble-bg-end: rgba(165, 196, 212, 0.15);
  --bubble-border: rgba(165, 196, 212, 0.5);
  --bubble-glow: rgba(165, 196, 212, 0.4);
  --bubble-bg-start-hover: rgba(165, 196, 212, 0.9);
  --bubble-bg-mid-hover: rgba(165, 196, 212, 0.6);
  --bubble-bg-end-hover: rgba(165, 196, 212, 0.25);
}

.bubble-9 {
  width: 18px;
  height: 18px;
  --bubble-bg-start: rgba(168, 181, 160, 0.7);
  --bubble-bg-mid: rgba(168, 181, 160, 0.4);
  --bubble-bg-end: rgba(168, 181, 160, 0.15);
  --bubble-border: rgba(168, 181, 160, 0.5);
  --bubble-glow: rgba(168, 181, 160, 0.4);
  --bubble-bg-start-hover: rgba(168, 181, 160, 0.9);
  --bubble-bg-mid-hover: rgba(168, 181, 160, 0.6);
  --bubble-bg-end-hover: rgba(168, 181, 160, 0.25);
}

.bubble-10 {
  width: 12px;
  height: 12px;
  --bubble-bg-start: rgba(212, 165, 165, 0.7);
  --bubble-bg-mid: rgba(212, 165, 165, 0.4);
  --bubble-bg-end: rgba(212, 165, 165, 0.15);
  --bubble-border: rgba(212, 165, 165, 0.5);
  --bubble-glow: rgba(212, 165, 165, 0.4);
  --bubble-bg-start-hover: rgba(212, 165, 165, 0.9);
  --bubble-bg-mid-hover: rgba(212, 165, 165, 0.6);
  --bubble-bg-end-hover: rgba(212, 165, 165, 0.25);
}

.bubble-11 {
  width: 26px;
  height: 26px;
  --bubble-bg-start: rgba(212, 184, 150, 0.7);
  --bubble-bg-mid: rgba(212, 184, 150, 0.4);
  --bubble-bg-end: rgba(212, 184, 150, 0.15);
  --bubble-border: rgba(212, 184, 150, 0.5);
  --bubble-glow: rgba(212, 184, 150, 0.4);
  --bubble-bg-start-hover: rgba(212, 184, 150, 0.9);
  --bubble-bg-mid-hover: rgba(212, 184, 150, 0.6);
  --bubble-bg-end-hover: rgba(212, 184, 150, 0.25);
}

.bubble-12 {
  width: 16px;
  height: 16px;
  --bubble-bg-start: rgba(165, 196, 212, 0.7);
  --bubble-bg-mid: rgba(165, 196, 212, 0.4);
  --bubble-bg-end: rgba(165, 196, 212, 0.15);
  --bubble-border: rgba(165, 196, 212, 0.5);
  --bubble-glow: rgba(165, 196, 212, 0.4);
  --bubble-bg-start-hover: rgba(165, 196, 212, 0.9);
  --bubble-bg-mid-hover: rgba(165, 196, 212, 0.6);
  --bubble-bg-end-hover: rgba(165, 196, 212, 0.25);
}

/* Responsive bubbles */
@media (max-width: 768px) {
  .bubble-1 { width: 30px; height: 30px; }
  .bubble-4 { width: 24px; height: 24px; }
  .bubble-2, .bubble-6 { width: 18px; height: 18px; }
  .bubble-3, .bubble-7, .bubble-10, .bubble-12 { width: 12px; height: 12px; }
  .bubble-5, .bubble-9 { width: 16px; height: 16px; }
  .bubble-8 { width: 18px; height: 18px; }
  .bubble-11 { width: 20px; height: 20px; }
}

@media (max-width: 480px) {
  .bubble-1 { width: 24px; height: 24px; }
  .bubble-4 { width: 20px; height: 20px; }
  .bubble-2, .bubble-6 { width: 14px; height: 14px; }
  .bubble-3, .bubble-7, .bubble-10, .bubble-12 { width: 10px; height: 10px; }
  .bubble-5, .bubble-9 { width: 12px; height: 12px; }
  .bubble-8 { width: 14px; height: 14px; }
  .bubble-11 { width: 16px; height: 16px; }
}

.hero-content {
  position: relative;
  z-index: 3;
  background: rgba(253, 251, 247, 0.85);
  backdrop-filter: blur(24px) saturate(1.2);
  padding: var(--space-8) var(--space-10);
  border-radius: 2rem;
  box-shadow: 
    0 32px 64px -12px rgba(0, 0, 0, 0.06),
    0 8px 24px -4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 900px;
  text-align: center;
  margin-top: -10vh;
}

/* Responsive hero content padding */
@media (max-width: 768px) {
  .hero-content {
    padding: var(--space-6) var(--space-8);
    max-width: 85%;
    margin-top: -8vh;
  }
}

@media (max-width: 480px) {
  .hero-content {
    padding: var(--space-4) var(--space-6);
    max-width: 90%;
    border-radius: var(--radius-xl);
    margin-top: -6vh;
  }
}

.hero-logo {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-charcoal);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.hero-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-3);
  color: var(--color-charcoal);
}

/* Responsive hero typography */
@media (max-width: 768px) {
  .hero-logo {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
  }
  
  .hero-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
  }
}

@media (max-width: 480px) {
  .hero-logo {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
  }
  
  .hero-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
  }
}

.magical-text {
  background: linear-gradient(45deg, var(--color-charcoal), var(--color-sage), var(--color-charcoal));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 3s ease-in-out infinite;
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--color-gray-warm);
  margin-bottom: 0;
}

/* Age Selection Overlay - Compact Design */
.age-selection-overlay {
  position: absolute;
  bottom: 18vh;
  left: 0;
  right: 0;
  z-index: 5;
  padding: var(--space-3) var(--space-6);
}

.age-overlay-content {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(253, 251, 247, 0.85);
  backdrop-filter: blur(24px) saturate(1.2);
  border-radius: var(--radius-2xl);
  padding: var(--space-4) var(--space-5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 20px 40px -8px rgba(0, 0, 0, 0.1),
    0 4px 12px -2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.age-selection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.age-cards-compact {
  display: flex;
  gap: var(--space-3);
  flex: 1;
}

.age-card-compact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(253, 251, 247, 0.9);
  border: 1.5px solid rgba(168, 181, 160, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  flex: 1;
  min-width: 0;
  max-width: 320px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (hover: hover) {
  .age-card-compact:hover {
    border-color: rgba(168, 181, 160, 0.5);
    background: rgba(168, 181, 160, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(168, 181, 160, 0.15);
  }
}

.age-card-compact.selected {
  border-color: var(--color-sage);
  background: linear-gradient(135deg, rgba(168, 181, 160, 0.12) 0%, rgba(168, 181, 160, 0.08) 100%);
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(168, 181, 160, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.age-icon-compact {
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.age-info-compact {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.age-title-compact {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-charcoal);
  line-height: 1.2;
}

.age-range-compact {
  font-size: var(--text-xs);
  color: var(--color-gray-warm);
  line-height: 1.2;
}

.quick-generate-btn {
  background: linear-gradient(135deg, var(--color-sage) 0%, #98a890 100%);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (hover: hover) {
  .quick-generate-btn:not(:disabled):hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(168, 181, 160, 0.4);
  }
}

.quick-generate-btn:disabled {
  background: var(--color-gray-soft);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.quick-generate-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.generate-icon {
  font-size: var(--text-base);
}

.generate-text {
  font-weight: 600;
}

/* Customize Story Button */
.customise-story-btn {
  position: absolute;
  bottom: -5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  z-index: 4;
  background: rgba(253, 251, 247, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-2xl);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 
    0 16px 32px -8px rgba(0, 0, 0, 0.1),
    0 4px 12px -2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  min-width: 180px;
}

.customise-story-btn:hover {
  background: rgba(168, 181, 160, 0.15);
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 
    0 20px 40px -12px rgba(0, 0, 0, 0.15),
    0 8px 24px -4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.customise-arrow {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(168, 181, 160, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: customizePulse 2s ease-in-out infinite;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.customise-story-btn.expanded .customise-arrow {
  transform: rotate(180deg);
}

.customise-text {
  font-size: var(--text-sm);
  color: var(--color-charcoal);
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-heading);
}

@media (max-width: 768px) {
  .age-selection-overlay {
    padding: var(--space-3) var(--space-4);
    bottom: 12vh;
  }
  
  .age-overlay-content {
    padding: var(--space-3) var(--space-4);
  }
  
  .age-selection-row {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .age-cards-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    width: 100%;
  }
  
  .age-card-compact {
    min-height: 64px;
    padding: var(--space-4) var(--space-3);
    font-size: var(--text-mobile-caption);
    justify-content: flex-start;
    text-align: left;
    max-width: none;
    gap: var(--space-2);
  }
  
  .age-icon-compact {
    font-size: var(--text-lg);
    flex-shrink: 0;
  }
  
  .age-title-compact {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-tight-mobile);
  }
  
  .age-range-compact {
    font-size: var(--text-xs);
    line-height: var(--leading-tight-mobile);
  }
  
  .quick-generate-btn {
    width: 100%;
    justify-content: center;
    min-height: 56px;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-mobile-button);
  }
  
  .customise-story-btn {
    bottom: -6vh;
    padding: var(--space-2) var(--space-4);
    min-width: 160px;
  }
  
  .customise-arrow {
    width: 20px;
    height: 20px;
  }
  
  .customise-text {
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  .age-selection-overlay {
    padding: var(--space-2) var(--space-3);
    bottom: 8vh;
  }
  
  .age-overlay-content {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-xl);
  }
  
  .age-cards-compact {
    gap: var(--space-1);
  }
  
  .age-card-compact {
    padding: var(--space-4) var(--space-2);
    min-height: 68px;
    justify-content: flex-start;
    text-align: left;
    gap: var(--space-2);
  }
  
  .age-icon-compact {
    font-size: var(--text-xl);
    flex-shrink: 0;
  }
  
  .age-title-compact {
    font-size: var(--text-sm);
    line-height: var(--leading-tight-mobile);
  }
  
  .age-range-compact {
    font-size: var(--text-xs);
    line-height: var(--leading-tight-mobile);
  }
  
  .quick-generate-btn {
    font-size: var(--text-mobile-button);
    padding: var(--space-4) var(--space-5);
    min-height: 56px;
  }
  
  .customise-story-btn {
    bottom: -8vh;
    padding: var(--space-2) var(--space-4);
    gap: var(--space-2);
    min-width: 140px;
  }
  
  .customise-arrow {
    width: 18px;
    height: 18px;
  }
  
  .customise-text {
    font-size: var(--text-xs);
  }
}
