/* WonderTales AI - Design tokens from iOS app */
:root {
  --primary-purple: #7C3AED;
  --primary-pink: #EC4899;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --border-color: rgba(124, 58, 237, 0.08);
  --header-bg: rgba(255, 255, 255, 0.95);
  --gradient: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-pink) 100%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.1), 0 2px 4px -2px rgba(124, 58, 237, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(124, 58, 237, 0.1), 0 8px 10px -6px rgba(124, 58, 237, 0.1);
}

/* Dark mode */
html.theme-dark {
  --text-primary: #FFFFFF;
  --text-secondary: #D1D5DB;
  --text-tertiary: #9CA3AF;
  --bg-primary: #000000;
  --bg-secondary: #1F2937;
  --bg-tertiary: #374151;
  --border-color: rgba(124, 58, 237, 0.2);
  --header-bg: rgba(0, 0, 0, 0.95);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: color 0.2s ease, background-color 0.2s ease;
}

h1, h2, h3, .font-display {
  font-family: "Nunito", "Quicksand", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
  color: var(--primary-purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Nunito", "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-primary);
}

.logo-icon {
  flex-shrink: 0;
  border-radius: 10px;
}

.hero-byline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.hero-byline-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.hero-brand {
  margin-bottom: 0.5rem;
}

.hero-app-icon {
  display: block;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-secondary);
  font-weight: 500;
}

.nav a:hover {
  color: var(--primary-purple);
}

.btn-app-store {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--primary-purple);
  color: white !important;
  border-radius: var(--radius-lg);
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-app-store:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none !important;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: 0.3s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    gap: 0;
    display: none;
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: 0.75rem;
  }
}

/* Hero */
.hero {
  padding: 4rem 1.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  min-height: 70vh;
}

.hero-content h1 {
  margin: 0 0 1rem;
  color: var(--text-primary);
}

.hero-content .tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-image {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-image {
    order: -1;
  }
}

/* Slider */
.slider-section {
  padding: 2rem 0 4rem;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
  overflow: hidden;
}

.slider-header {
  text-align: center;
  margin-bottom: 2rem;
}

.slider-header h2 {
  margin: 0 0 0.25rem;
}

.slider-header p {
  margin: 0;
  color: var(--text-secondary);
}

.slider-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow: hidden;
}

.slider-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.slider-slide {
  flex: 0 0 240px;
  flex-shrink: 0;
  min-width: 240px;
  width: 240px;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

.slider-slide img {
  width: 100%;
  max-width: 240px;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: block;
  vertical-align: top;
}

@media (min-width: 600px) {
  .slider-slide {
    flex: 0 0 320px;
    min-width: 320px;
    width: 320px;
  }
  .slider-slide img {
    max-width: 320px;
    max-height: 320px;
  }
}

@media (min-width: 900px) {
  .slider-slide {
    flex: 0 0 380px;
    min-width: 380px;
    width: 380px;
  }
  .slider-slide img {
    max-width: 380px;
    max-height: 380px;
  }
}

/* Pause on hover handled by slider.js */

/* Sections */
.section {
  padding: 4rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  margin: 0 0 0.5rem;
}

.section-header p {
  color: var(--text-secondary);
  margin: 0;
}

/* Features grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.feature-card h3 {
  margin: 0 0 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  margin: 0;
}

/* Story showcase */
.story-showcase {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.story-showcase .section-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.story-showcase .story-text {
  flex: 1;
  min-width: 300px;
}

.story-showcase .story-image {
  flex: 1;
  min-width: 300px;
  text-align: center;
}

.story-showcase .story-image img {
  max-width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* Page content (privacy, terms, support) */
.page-content {
  padding: 2rem 1.5rem 4rem;
  max-width: 720px;
  margin: 0 auto;
}

.page-content h1 {
  margin: 0 0 1rem;
}

.page-content .intro {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.policy-section {
  margin-bottom: 2rem;
}

.policy-section h3 {
  margin: 0 0 0.5rem;
}

.policy-section p {
  color: var(--text-secondary);
  margin: 0;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.faq-item h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.faq-item p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.footer-brand-name {
  font-weight: 500;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--primary-purple);
}

.footer-contact a {
  color: var(--primary-purple);
}

/* Theme switcher */
.theme-toggle {
  position: relative;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
}

.theme-btn:hover {
  background: var(--bg-tertiary);
}

.theme-btn svg {
  width: 20px;
  height: 20px;
}

.theme-icon-dark {
  display: none;
}

.theme-icon-light {
  display: block;
}

html.theme-dark .theme-icon-dark {
  display: block;
}

html.theme-dark .theme-icon-light {
  display: none;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 160px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  display: none;
  z-index: 200;
}

.theme-dropdown.is-open {
  display: block;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.theme-option:hover {
  background: var(--bg-secondary);
}

.theme-option.is-active {
  color: var(--primary-purple);
  font-weight: 600;
}

.theme-option svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
