/* =========================================================
   قُلَک — Financial Education for Kids (MVP)
   Design tokens + global styles
   ========================================================= */

:root {
  /* ---- Color tokens ---- */
  --bg: #FBF8F1;
  --bg-alt: #F3EFE3;
  --ink: #0B3D3A;
  --ink-soft: #3A5957;

  --mint: #2DD4B3;
  --mint-dark: #14998A;
  --mint-light: #D8F5EE;

  --gold: #F5B942;
  --gold-dark: #D9952A;
  --gold-light: #FCE9C2;

  --coral: #FF6F59;
  --coral-dark: #E04F3C;
  --coral-light: #FFE0D9;

  --indigo: #5B5FEF;
  --indigo-dark: #4144C2;
  --indigo-light: #E3E3FC;

  --white: #FFFFFF;
  --line: rgba(11, 61, 58, 0.12);
  --shadow-color: 11, 61, 58;

  /* ---- Type ---- */
  --font-main: 'Vazirmatn', Tahoma, sans-serif;

  /* ---- Radii / shadows ---- */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --shadow-card: 0 4px 18px rgba(var(--shadow-color), 0.07), 0 1px 3px rgba(var(--shadow-color), 0.06);
  --shadow-card-hover: 0 14px 34px rgba(var(--shadow-color), 0.14), 0 2px 6px rgba(var(--shadow-color), 0.08);
  --shadow-modal: 0 24px 60px rgba(var(--shadow-color), 0.25);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* subtle grain overlay for warmth */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* focus visibility */
a:focus-visible,
button:focus-visible,
.option-btn:focus-visible {
  outline: 3px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 8px;
}

/* =========================================================
   Typography helpers
   ========================================================= */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--mint-dark);
  margin-bottom: 14px;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

.eyebrow-light {
  color: var(--gold-light);
}

.eyebrow-light::before {
  background: var(--white);
}

h1 {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.3;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.hl {
  color: var(--mint-dark);
}

.hl-alt {
  color: var(--coral-dark);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), background 0.22s var(--ease);
}

.btn svg {
  transform: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-large {
  padding: 16px 30px;
  font-size: 1.02rem;
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.88rem;
}

.btn-primary {
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(11, 61, 58, 0.25);
}

.btn-primary:hover {
  background: #0F4D49;
  box-shadow: 0 12px 26px rgba(11, 61, 58, 0.32);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(245, 185, 66, 0.4);
}

.btn-gold:hover {
  background: #FFC862;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
}

.btn-ghost:hover {
  background: var(--white);
  border-color: var(--ink);
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(251, 248, 241, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.main-nav a {
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--ink);
}

.main-nav a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease);
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

.header-cta {
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
}

.mobile-nav {
  display: none;
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  padding-top: 64px;
  background:
    radial-gradient(ellipse 60% 50% at 85% 0%, rgba(245, 185, 66, 0.18), transparent 60%),
    radial-gradient(ellipse 55% 45% at 5% 20%, rgba(45, 212, 179, 0.16), transparent 60%),
    var(--bg);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 40px;
  padding-bottom: 70px;
  position: relative;
  z-index: 1;
}

.hero-desc {
  margin-top: 22px;
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.hero-stats {
  display: flex;
  gap: 36px;
  margin-top: 46px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

#heroJar {
  max-width: 640px;
  width: 100%;
  height: auto;
  animation: jarFloat 4.5s ease-in-out infinite;
}

@keyframes jarFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-14px);
  }
}

.floaty {
  position: absolute;
  font-weight: 800;
  color: var(--ink);
  opacity: 0.15;
  font-size: 2.2rem;
  animation: floatY 6s ease-in-out infinite;
}

.floaty-1 {
  top: 10%;
  right: 8%;
  color: var(--mint-dark);
  animation-delay: 0s;
}

.floaty-2 {
  bottom: 18%;
  left: 4%;
  color: var(--gold-dark);
  font-size: 2.6rem;
  animation-delay: -2s;
}

.floaty-3 {
  top: 48%;
  right: -2%;
  color: var(--coral-dark);
  animation-delay: -4s;
}

@keyframes floatY {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-16px) rotate(8deg);
  }
}

.hero-divider {
  display: block;
  width: 100%;
  height: 50px;
}

/* =========================================================
   Sections
   ========================================================= */
.section {
  padding: 90px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
}

.section-head.align-start {
  text-align: start;
  margin-inline: 0;
}

.section-desc {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 1.04rem;
}

/* =========================================================
   Card grid (animations + games)
   ========================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 26px;
}

#gamesGrid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

@media (min-width: 980px) {
  #gamesGrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.media-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  cursor: pointer;
  text-align: start;
  padding: 0;
}

.media-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

.media-thumb {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
}

.media-card:hover .media-thumb img {
  transform: scale(1.07);
}

.media-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
}

.media-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(11, 61, 58, 0) 40%, rgba(11, 61, 58, 0.45) 100%);
}

.media-play-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: scale(0.92);
  transition: transform 0.25s var(--ease);
}

.media-card:hover .media-play-icon {
  transform: scale(1.05);
}

.media-play-icon svg {
  margin-inline-start: -2px;
}

.media-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}

.media-badge.badge-game {
  background: var(--coral);
  color: var(--white);
}

.media-body {
  padding: 18px 20px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.media-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.media-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  flex: 1;
}

.media-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--mint-dark);
}

.media-cta svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s;
}

.media-card:hover .media-cta svg {
  transform: translateX(-3px);
}

.badge-game~.media-body .media-cta,
.media-card.is-game .media-cta {
  color: var(--coral-dark);
}

/* =========================================================
   Quiz CTA banner
   ========================================================= */
.quiz-cta {
  background: linear-gradient(135deg, var(--indigo) 0%, #4347C9 55%, #383BB0 100%);
  position: relative;
  overflow: hidden;
  color: var(--white);
}

.quiz-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(245, 185, 66, 0.25), transparent 45%),
    radial-gradient(circle at 5% 90%, rgba(45, 212, 179, 0.2), transparent 45%);
}

.quiz-cta-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 40px;
  padding: 86px 0;
}

.quiz-cta-copy h2 {
  color: var(--white);
  margin-bottom: 16px;
}

.quiz-cta-copy p {
  color: rgba(255, 255, 255, 0.86);
  max-width: 50ch;
  margin-bottom: 30px;
  font-size: 1.04rem;
}

.quiz-cta-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-cta-visual img {
  width: 100%;
  max-width: 480px;
  height: auto;
  animation: pulseRing 5s ease-in-out infinite;
}

@keyframes pulseRing {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

/* =========================================================
   About section
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.about-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px 24px;
}

.about-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.about-card h3 {
  margin-bottom: 10px;
}

.about-card p {
  color: var(--ink-soft);
  font-size: 0.96rem;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-brand {
  font-size: 1.05rem;
}

.footer-note {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* =========================================================
   Modals
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 61, 58, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.32s var(--ease);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, background 0.2s;
}

.modal-close:hover {
  background: var(--coral-light);
  transform: rotate(90deg);
}

/* --- animation modal --- */
.modal-media {
  max-width: 760px;
  padding-bottom: 4px;
}

.modal-media-frame {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--ink);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-media-frame iframe,
.modal-media-frame video {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-media-placeholder {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  text-align: center;
  padding: 30px;
}

.modal-media-info {
  padding: 26px 30px 30px;
}

.modal-media-info h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.modal-media-info p {
  color: var(--ink-soft);
}

/* --- quiz modal --- */
.modal-quiz {
  max-width: 560px;
  padding: 44px 36px 36px;
  text-align: center;
}

.quiz-screen {}

.quiz-jar-mini {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.modal-quiz h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.modal-quiz>.quiz-screen>p {
  color: var(--ink-soft);
  max-width: 38ch;
  margin: 0 auto 26px;
}

#quizQuestions {
  text-align: start;
}

.quiz-progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  margin-bottom: 8px;
  padding-inline-end: 48px;
}

.quiz-progress-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mint), var(--mint-dark));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}

.quiz-progress-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quiz-xp-tally {
  margin: 14px 0 22px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.quiz-xp-tally strong {
  color: var(--gold-dark);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.quiz-question-title {
  font-size: 1.22rem;
  margin-bottom: 22px;
  line-height: 1.55;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  text-align: start;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.option-btn:hover {
  border-color: var(--mint);
  background: var(--mint-light);
  transform: translateX(-2px);
}

.option-letter {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.option-btn:hover .option-letter {
  background: var(--mint);
  color: var(--white);
}

.option-btn.selected {
  border-color: var(--mint-dark);
  background: var(--mint-light);
}

/* --- result screen --- */
.result-jar {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.result-jar img {
  width: 100%;
  max-width: 320px;
  height: auto;
  animation: pulseRing 5s ease-in-out infinite;
}

.result-eyebrow {
  font-weight: 700;
  color: var(--mint-dark);
  margin-bottom: 6px;
}

#quizResult h3 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

#resultXpNum {
  color: var(--gold-dark);
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.result-rank {
  display: inline-block;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 6px 16px;
  border-radius: 999px;
  margin: 10px 0 18px;
}

.result-message {
  color: var(--ink-soft);
  max-width: 40ch;
  margin: 0 auto 26px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* xp pop animation when coin lands */
@keyframes xpPop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.25);
  }

  100% {
    transform: scale(1);
  }
}

.xp-pop {
  animation: xpPop 0.4s var(--ease);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    order: -1;
    min-height: 280px;
  }

  .quiz-cta-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .quiz-cta-copy p {
    margin-inline: auto;
  }

  .quiz-cta-visual {
    order: -1;
  }

  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .main-nav {
    display: none;
  }

  .header-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
  }

  .nav-toggle span {
    display: block;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
  }

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

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

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

  .mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease), padding 0.3s var(--ease);
  }

  .mobile-nav.is-open {
    max-height: 320px;
    padding: 10px 24px 22px;
  }

  .mobile-nav a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
  }

  .mobile-nav .btn {
    margin-top: 14px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    gap: 24px;
  }

  .modal-quiz {
    padding: 36px 22px 26px;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 64px 0;
  }

  h1 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
  }
}
