/* ============================================================
   BrainFusion V2 Homepage
   ============================================================
   "Warm Authority" -- editorial confidence meets educational
   warmth. Dramatic typography, generous space, soft depth.
   ============================================================ */

/* ---- Scroll-Triggered Reveals ---- */
.v2-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.v2-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children within a container (desktop only) */
@media (min-width: 640px) {
  .v2-stagger > .v2-reveal:nth-child(1) { transition-delay: 0ms; }
  .v2-stagger > .v2-reveal:nth-child(2) { transition-delay: 120ms; }
  .v2-stagger > .v2-reveal:nth-child(3) { transition-delay: 240ms; }
  .v2-stagger > .v2-reveal:nth-child(4) { transition-delay: 360ms; }
  .v2-stagger > .v2-reveal:nth-child(5) { transition-delay: 480ms; }
  .v2-stagger > .v2-reveal:nth-child(6) { transition-delay: 600ms; }
}

/* ---- Hero Entry Animation ---- */
.v2-hero-enter {
  opacity: 0;
  transform: translateY(24px);
  animation: heroFadeIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.v2-hero-enter:nth-child(1) { animation-delay: 0.15s; }
.v2-hero-enter:nth-child(2) { animation-delay: 0.3s; }
.v2-hero-enter:nth-child(3) { animation-delay: 0.45s; }
.v2-hero-enter:nth-child(4) { animation-delay: 0.6s; }

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Hero Background Atmosphere ---- */
.v2-hero-atmosphere {
  position: relative;
  overflow: hidden;
}

.v2-hero-atmosphere::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -25%;
  width: 800px;
  height: 800px;
  background: radial-gradient(
    circle,
    var(--v2-atmosphere-brand) 0%,
    var(--v2-atmosphere-brand-subtle) 40%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
}

.v2-hero-atmosphere::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    var(--v2-atmosphere-accent) 0%,
    transparent 65%
  );
  border-radius: 50%;
  pointer-events: none;
}

/* ---- Headline Accent Underline ---- */
/* ---- Focus Visible ---- */
.v2-game-card:focus-visible,
.v2-faq-trigger:focus-visible {
  outline: 2px solid var(--v2-brand-primary);
  outline-offset: 2px;
}

/* ---- Step Cards ---- */
.v2-step-number {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--v2-font-display);
  font-weight: 800;
  font-size: 1.125rem;
  background: var(--v2-brand-primary);
  color: var(--v2-text-inverse);
  flex-shrink: 0;
  box-shadow: var(--v2-shadow-brand-step);
}

/* Step connector (desktop only) */
.v2-step-card {
  position: relative;
}

@media (min-width: 768px) {
  .v2-step-card:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1.5rem;
    right: -1.5rem;
    width: 3rem;
    height: 2px;
    background: linear-gradient(
      to right,
      var(--v2-border-strong),
      transparent
    );
  }
}

/* ---- Feature Cards (non-interactive, no hover lift) ---- */

.v2-feature-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ---- Game Cards ---- */
.v2-game-card {
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.v2-game-card:hover {
  box-shadow: var(--v2-shadow-neutral-hover);
  border-color: var(--v2-brand-primary);
}

/* Game card button reset */
button.v2-game-card {
  cursor: pointer;
  font: inherit;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
  appearance: none;
}

.v2-game-card-hint {
  font-size: 0.8rem;
  color: var(--v2-text-muted);
  margin-top: 0.75rem;
  transition: color 0.2s ease;
}

.v2-game-card:hover .v2-game-card-hint {
  color: var(--v2-brand-primary);
}

/* ---- Game Detail Modal ---- */
.v2-game-modal {
  --wa-color-surface-raised: var(--v2-surface-card);
  --wa-color-text-normal: var(--v2-text-primary);
  --wa-color-text-quiet: var(--v2-text-muted);
}

.v2-game-modal {
  --wa-color-surface-raised: var(--v2-surface-card);
  --wa-color-surface-overlay: var(--v2-surface-card);
  --wa-color-overlay-modal: var(--v2-surface-overlay);
  --wa-color-text-normal: var(--v2-text-primary);
  --wa-color-text-quiet: var(--v2-text-muted);
  --wa-color-surface-hover: color-mix(in srgb, var(--v2-text-muted) 12%, var(--v2-surface-card));
  --wa-panel-border-radius: 1rem;
}

.v2-game-modal::part(panel) {
  max-width: 600px;
  width: 90vw;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--v2-surface-card);
  border: 1px solid var(--v2-border-default);
  font-family: var(--v2-font-body);
  color: var(--v2-text-primary);
}

.v2-game-modal::part(header) {
  background: var(--v2-surface-card);
  color: var(--v2-text-primary);
}

.v2-game-modal::part(close-button) {
  color: var(--v2-text-muted);
}

.v2-game-modal::part(close-button__base) {
  color: var(--v2-text-muted);
  transition: color var(--v2-transition-fast), background-color var(--v2-transition-fast);
}

.v2-game-modal::part(close-button__base):hover {
  color: var(--v2-text-secondary);
  background-color: color-mix(in srgb, var(--v2-text-muted) 8%, transparent);
}

.v2-game-modal::part(overlay) {
  background: var(--v2-surface-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.v2-game-modal::part(body) {
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.v2-game-carousel {
  --aspect-ratio: 16 / 9;
}

.v2-game-carousel::part(navigation-button) {
  color: white;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  padding: 0;
  justify-content: center;
}

.v2-game-carousel::part(navigation-button-previous) {
  margin-left: 0.5rem;
}

.v2-game-carousel::part(navigation-button-next) {
  margin-right: 0.5rem;
}

.v2-game-carousel::part(pagination-item) {
  background: rgba(255, 255, 255, 0.6);
}

.v2-game-carousel::part(pagination-item-active) {
  background: white;
}

.v2-game-carousel picture {
  display: block;
  width: 100%;
}

.v2-game-modal-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.v2-game-modal-body {
  padding: 1.5rem;
  color: var(--v2-text-primary);
}

.v2-game-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.v2-game-modal-header h3 {
  font-family: var(--v2-font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--v2-text-primary);
  margin: 0;
}

.v2-game-modal-header span {
  font-size: 1.75rem;
  line-height: 1;
}

.v2-game-modal-subtitle {
  font-size: 0.8rem;
  color: var(--v2-text-muted);
  font-weight: 500;
  margin-top: 0.125rem;
}

.v2-game-modal-desc {
  color: var(--v2-text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.v2-game-modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--v2-brand-primary);
  background: color-mix(in srgb, var(--v2-brand-primary) 10%, var(--v2-surface-card));
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

.v2-game-modal-section-title {
  font-family: var(--v2-font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--v2-text-muted);
  margin-bottom: 0.5rem;
}

.v2-game-modal-best-for {
  list-style: none;
  padding: 0;
  margin: 0;
}

.v2-game-modal-best-for li {
  font-size: 0.9rem;
  color: var(--v2-text-secondary);
  padding: 0.25rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.v2-game-modal-best-for li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--v2-brand-primary);
  flex-shrink: 0;
  margin-top: 0.4rem;
}

.v2-game-modal::part(footer) {
  border-top: 1px solid var(--v2-border-default);
  background: var(--v2-surface-card);
  padding: 0;
}

.v2-game-modal-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  width: 100%;
}

.v2-lightbox {
  --width: fit-content;
  --wa-color-surface-raised: transparent;
  --spacing: 0px;
}

.v2-lightbox::part(panel) {
  max-width: 90vw;
  max-height: 90vh;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.v2-lightbox::part(header) {
  display: none;
}

.v2-lightbox::part(body) {
  padding: 0;
}

.v2-lightbox::part(overlay) {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: zoom-out;
}

#v2-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0;
  display: block;
}

.v2-game-emoji {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--v2-brand-primary);
}

.v2-game-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  color: var(--v2-brand-primary);
  background: color-mix(in srgb, var(--v2-brand-primary) 10%, var(--v2-surface-card));
  border-radius: 0.5rem;
  flex-shrink: 0;
}

/* ---- FAQ Accordion ---- */
.v2-faq-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--v2-border-default);
}

.v2-faq-item:last-child {
  border-bottom: none;
}

.v2-faq-trigger {
  cursor: pointer;
  width: 100%;
  padding: 1.25rem 0;
  font-family: var(--v2-font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--v2-text-primary);
  background: none;
  border: none;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: color 0.2s ease;
  white-space: normal;
}

.v2-faq-trigger:hover {
  color: var(--v2-brand-primary);
}

.v2-faq-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--v2-brand-primary) 10%, var(--v2-surface-card));
  color: var(--v2-brand-primary);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s ease;
}

.v2-faq-trigger[aria-expanded="true"] .v2-faq-icon {
  transform: rotate(45deg);
  background: color-mix(in srgb, var(--v2-brand-primary) 18%, var(--v2-surface-card));
}

.v2-faq .v2-faq-body {
  padding: 0 0 1.25rem;
  color: var(--v2-text-secondary);
  line-height: 1.75;
  font-size: 0.95rem;
  max-width: 56ch;
}

/* ---- CTA Section ---- */
.v2-cta-section {
  background: linear-gradient(135deg, var(--v2-cta-gradient-start) 0%, var(--v2-cta-gradient-end) 100%);
  color: var(--v2-cta-section-text);
  position: relative;
  overflow: hidden;
}

.v2-cta-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--v2-cta-orb) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

/* ---- Science Section Decorative ---- */
.v2-science-card {
  position: relative;
  overflow: hidden;
}

.v2-science-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--v2-science-gradient-brand), var(--v2-science-gradient-accent));
  border-radius: 2px 2px 0 0;
}

/* ---- Trust Stat Counter ---- */
.v2-stat-value {
  font-family: var(--v2-font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  color: var(--v2-brand-primary);
}

/* Button styles (v2-cta-primary, v2-cta-secondary, v2-cta-on-dark)
   moved to shared file: css/wa-theme.css (loaded globally by _LayoutV2) */

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .v2-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .v2-hero-enter {
    opacity: 1;
    transform: none;
    animation: none;
  }

}
