@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Global mobile overflow prevention */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure all containers respect viewport */
* {
  box-sizing: border-box;
}

/* Global button text truncation for mobile */
button, .btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hero OTF Styles */
.hero-otf {
  position: relative;
  background: linear-gradient(
    135deg,
    hsl(220 100% 97%) 0%,
    hsl(230 100% 98%) 20%,
    hsl(240 100% 99%) 40%,
    hsl(250 100% 99%) 60%,
    hsl(250 100% 98%) 80%,
    hsl(260 100% 97%) 100%
  );
  color: hsl(var(--foreground));
  padding: 80px 0 60px;
  overflow: hidden;
}

.hero-otf::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.10), transparent 50%);
  pointer-events: none;
}

.hero-wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 20px 28px;
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  align-items: center;
}

@media(min-width: 1024px) {
  .hero-wrap {
    grid-template-columns: 1.1fr .9fr;
    min-height: 70vh;
  }
}

.chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.08), hsl(var(--accent) / 0.08));
  border: 1px solid hsl(var(--primary) / 0.2);
  color: hsl(var(--primary));
  letter-spacing: 0.02em;
}

.hero-otf h1 {
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  margin: 16px 0 12px;
  color: hsl(var(--foreground));
  letter-spacing: -0.02em;
}

.subtitle {
  color: hsl(var(--muted-foreground));
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 560px;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 20px;
}

.cta-helper {
  margin: 6px 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  opacity: 0.85;
}

.trust-row {
  display: flex;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
  flex-wrap: wrap;
}

.trust-row li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, hsl(215 50% 98%), hsl(215 50% 96%));
  color: hsl(215 30% 25%);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .trust-row li {
    gap: 6px;
    padding: 7px 14px;
    font-size: 14px;
  }
}

.trust-row li::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: hsl(var(--success));
  color: white;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
  .btn {
    padding: 16px 32px;
    font-size: 16px;
  }
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-glow)));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 8px 24px hsl(var(--primary) / 0.25);
  font-size: 15px;
  padding: 14px 28px;
}

@media (min-width: 768px) {
  .btn-primary {
    font-size: 17px;
    padding: 17px 36px;
  }
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px hsl(var(--primary) / 0.4);
  background: linear-gradient(135deg, hsl(var(--primary-glow)), hsl(var(--primary)));
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-outline {
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
  background: hsl(var(--card));
}

.btn-outline:hover {
  background: hsl(var(--accent) / 0.08);
  border-color: hsl(var(--primary) / 0.3);
  transform: translateY(-1px);
}


.hero-right {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Trust Grid */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 24px;
}

@media (min-width: 640px) {
  .trust-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .trust-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 8px;
  padding: 12px 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--foreground));
  transition: all 0.2s ease;
  min-height: 90px;
}

@media (min-width: 768px) {
  .trust-item {
    font-size: 13px;
    padding: 14px 12px;
    min-height: 95px;
  }
}

.trust-item:hover {
  background: hsl(var(--accent) / 0.5);
  border-color: hsl(var(--primary) / 0.3);
  transform: translateY(-2px);
}

/* Demo Card Container */
.demo-card-container {
  perspective: 1000px;
  width: 100%;
  max-width: 400px;
}

/* Completion Card Styles */
.completion-card {
  background: hsl(var(--card));
  border: 2px solid hsl(var(--primary) / 0.2);
  border-radius: 1rem;
  box-shadow: 0 20px 50px hsl(var(--primary) / 0.1);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Animations */
@keyframes scale-out {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

@keyframes scale-in {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes trophy-bounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(-5deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(-10px) rotate(5deg);
  }
}

@keyframes xp-glow {
  0%, 100% {
    text-shadow: 0 0 10px hsl(var(--primary) / 0.5);
  }
  50% {
    text-shadow: 0 0 20px hsl(var(--primary) / 0.8), 0 0 30px hsl(var(--primary) / 0.4);
  }
}

.animate-scale-out {
  animation: scale-out 0.4s ease-out forwards;
}

.animate-scale-in {
  animation: scale-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.trophy-bounce {
  animation: trophy-bounce 1s ease-in-out;
}

.xp-glow {
  animation: xp-glow 2s ease-in-out infinite;
}

.demo-flashcard-wrapper {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  outline: none;
  cursor: pointer;
  min-height: 200px;
}

@media (min-width: 768px) {
  .demo-flashcard-wrapper {
    min-height: 240px;
  }
}

.demo-flashcard-wrapper:focus {
  outline: none;
}

.demo-flashcard-wrapper:focus-visible {
  outline: none;
}

.demo-flashcard-wrapper.flipped {
  transform: rotateY(180deg);
}

.demo-flashcard-side {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  width: 100%;
}

.demo-flashcard-front {
  position: relative;
  z-index: 2;
}

.demo-flashcard-back {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: rotateY(180deg);
}

.demo-card-label {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
}

.card-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  perspective: 1000px;
}

/* Legacy card styles - can be removed if not used elsewhere */

/* Demo Card Content Styles */
.term {
  font-weight: 800;
  font-size: 38px;
  color: hsl(var(--primary));
  letter-spacing: -0.01em;
}

.definition {
  font-weight: 700;
  font-size: 21px;
  color: hsl(var(--foreground));
  line-height: 1.4;
}

.hint {
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 500;
  opacity: 0.75;
}

/* How It Works Section */
.how {
  background: #fafbff;
  border-top: 1px solid #eef2ff;
  padding: 56px 0;
}

.how-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.how h2 {
  font-size: clamp(22px, 3.2vw, 32px);
  margin: 0 0 18px;
  font-weight: 700;
  color: hsl(var(--foreground));
  text-align: center;
}

.how-grid {
  display: none;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media(min-width: 768px) {
  .how-grid {
    display: grid;
  }
}

@media(min-width: 960px) {
  .how-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.how-card {
  background: hsl(var(--card));
  border: 1px solid #e6ebff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

@media (min-width: 768px) {
  .how-card {
    padding: 18px;
  }
}

.how-card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-weight: 800;
  background: #eef2ff;
  color: #334155;
  border: 1px solid #e2e8ff;
  margin-bottom: 8px;
}

.how-card h3 {
  margin: 4px 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.muted {
  color: hsl(var(--muted-foreground));
}

.ticks {
  margin: 10px 0 0 18px;
  padding: 0;
  color: hsl(var(--foreground));
  list-style: none;
}

.ticks li {
  margin: 4px 0;
  position: relative;
  padding-left: 20px;
}

.ticks li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: hsl(var(--primary));
  font-weight: 700;
}

.how-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  justify-content: center;
}

/* Popular Decks Section */
.decks {
  padding: 48px 0;
  border-top: 1px solid #eef2ff;
  background: #fafbff;
}

.decks-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.decks-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.decks h2 {
  font-size: clamp(22px, 3.2vw, 32px);
  margin: 0;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.deck-search {
  display: flex;
  gap: 8px;
}

.deck-search input {
  background: #fff;
  border: 1px solid #e5eafe;
  border-radius: 999px;
  padding: 10px 14px;
  min-width: 220px;
  color: #0b1020;
  outline: none;
}

.deck-search input:focus {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.deck-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}

.deck-chips .chip {
  background: #f1f4ff;
  border: 1px solid #e3e9ff;
  color: #26324d;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
}

.deck-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}

@media(min-width: 960px) {
  .deck-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.deck-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e6ebff;
  border-radius: 16px;
  padding: 18px;
  text-decoration: none;
  color: #0b1020;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  min-height: 200px;
}

.deck-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.deck-card h3 {
  margin: 4px 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.deck-card .muted {
  color: #6b7280;
}

.deck-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #e5eafe;
  background: #f5f7ff;
  color: #334155;
}

.decks-cta {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Testimonials Section */
.testimonials {
  padding: 48px 0;
  border-top: 1px solid #eef2ff;
  background: #ffffff;
}

.t-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.testimonials h2 {
  font-size: clamp(22px, 3.2vw, 32px);
  margin: 0 0 6px;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.t-sub {
  color: #6b7280;
  margin: 0 0 14px;
}

.t-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media(min-width: 960px) {
  .t-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.t-card {
  background: #fff;
  border: 1px solid #e6ebff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.t-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0b1020;
  background: #f1f5ff;
  border: 1px solid #e4eaff;
}

.t-name {
  font-weight: 700;
  color: hsl(var(--foreground));
}

.t-role {
  font-size: 12px;
  color: #6b7280;
}

.t-stars {
  margin-left: auto;
  color: #f59e0b;
  font-size: 14px;
  letter-spacing: 1px;
}

blockquote {
  margin: 0;
  color: #0f172a;
  line-height: 1.55;
}

.t-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  justify-content: center;
}

/* Prevent horizontal scrolling on mobile */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Definition of the design system. All colors, gradients, fonts, etc should be defined here. 
All colors MUST be HSL.
*/

/* Performance: Reduce paint complexity */
* {
  box-sizing: border-box;
}

/* Accessibility & Performance: Screen reader only content and optimizations */

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 20%;

    --card: 0 0% 100%;
    --card-foreground: 0 0% 20%;

    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 20%;

    --primary: 180 100% 21%;
    --primary-foreground: 0 0% 98%;
    --primary-glow: 180 100% 30%;

    --secondary: 0 0% 96%;
    --secondary-foreground: 0 0% 20%;

    --muted: 0 0% 96%;
    --muted-foreground: 0 0% 45%;

    --accent: 0 100% 71%;
    --accent-foreground: 0 0% 98%;
    --accent-glow: 0 100% 80%;

    --success: 145 66% 47%;
    --success-foreground: 0 0% 98%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;

    --border: 0 0% 90%;
    --input: 0 0% 90%;
    --ring: 180 100% 21%;

    /* Gradient variables using new colors */
    --text-gradient: linear-gradient(135deg, hsl(180 100% 21%), hsl(0 100% 71%));
    
    --shadow-primary: 0 10px 30px -10px hsl(180 100% 21% / 0.3);
    --shadow-glow: 0 0 40px hsl(180 100% 30% / 0.2);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --radius: 0.5rem;
  }
}

/* Force white background globally to prevent gradient flash */
html, body {
  background: hsl(var(--background)) !important;
  min-height: 100%;
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
  }
}

/* Custom scrollbar utilities */
@layer utilities {
  /* Rich text editor prose styles */
  .prose {
    color: hsl(var(--foreground));
  }
  
  .prose h1 {
    font-size: 2em;
    font-weight: 700;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
  }
  
  .prose h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 0.83em;
    margin-bottom: 0.83em;
  }
  
  .prose h3 {
    font-size: 1.17em;
    font-weight: 600;
    margin-top: 1em;
    margin-bottom: 1em;
  }
  
  .prose p {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
  }
  
  .prose strong {
    font-weight: 600;
  }
  
  .prose em {
    font-style: italic;
  }
  
  .prose ul, .prose ol {
    padding-left: 1.5em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
  }
  
  .prose ul {
    list-style-type: disc;
  }
  
  .prose ol {
    list-style-type: decimal;
  }
  
  .prose li {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
  }
  
  .prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 1em auto;
  }

  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
  
  .scrollbar-default {
    -ms-overflow-style: auto;
    scrollbar-width: auto;
  }
  
  .scrollbar-default::-webkit-scrollbar {
    display: block;
  }
  
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }

  /* Performance optimizations */
  img {
    content-visibility: auto;
  }
  
  /* Content visibility optimizations for below-the-fold sections */
  .section-below-fold {
    content-visibility: auto;
    contain-intrinsic-size: 800px;
  }

  /* Optimize commonly used below-the-fold sections */
  .features-section,
  .testimonials-section,
  .faq-section,
  .comparison-section,
  .cta-section,
  .how-it-works-section,
  .price-simulator-section {
    content-visibility: auto;
    contain-intrinsic-size: 600px;
  }

  /* Lazy image optimizations - ensure no CLS */
  img[loading="lazy"] {
    min-height: 200px; /* Prevent layout shift */
  }

  /* Blog images with proper aspect ratio */
  .blog-featured-image {
    aspect-ratio: 16/9;
    object-fit: cover;
  }
  
  /* Better focus indicators for accessibility */
  .focus-visible {
    @apply ring-2 ring-primary ring-offset-2 ring-offset-background;
  }
  
  /* Reduced motion for users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    .animate-spin,
    .animate-pulse,
    .animate-bounce {
      animation: none;
    }
  }

  /* Hover scale animation */
  .hover-scale {
    @apply transition-transform duration-200 hover:scale-105;
  }

  /* Grid pattern for backgrounds */
  .bg-grid-white\/5 {
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
  }
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Account for fixed header so anchors don't hide beneath it */
[id] {
  scroll-margin-top: 80px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
