/* ═══════════════════════════════════════════════
   Math4ChildrenPlus.com  — Global Stylesheet
   Design: Bold editorial, warm academic energy
═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&family=Lato:wght@400;700&display=swap');

:root {
  --brand:      #E84545;
  --brand-dk:   #C0392B;
  --brand-lt:   #FFF0F0;
  --accent:     #2C7BE5;
  --accent-lt:  #EBF3FF;
  --gold:       #F5A623;
  --gold-lt:    #FFF8EC;
  --green:      #27AE60;
  --green-lt:   #E9F9F1;
  --purple:     #8E44AD;
  --purple-lt:  #F4EEF9;
  --teal:       #16A085;
  --teal-lt:    #E8F8F5;

  --dark:       #1A1A2E;
  --mid:        #444466;
  --light:      #F7F8FC;
  --white:      #FFFFFF;
  --border:     #E8EAF0;

  --nav-h:      64px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow:     0 4px 20px rgba(0,0,0,.09);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.14);
  --font:       'Poppins', sans-serif;
  --font-body:  'Lato', sans-serif;
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--light);
  color: var(--dark);
  line-height: 1.65;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAVIGATION ── */
.site-nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
  background: var(--dark);
  display: flex; align-items: center;
  padding: 0 2rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
  gap: 2rem;
}
.nav-logo {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900; color: white;
  font-family: var(--font);
}
.nav-logo-text {
  font-family: var(--font);
  font-weight: 800; font-size: 1rem;
  color: white; line-height: 1.15;
}
.nav-logo-text small {
  display: block; font-size: .68rem; font-weight: 600;
  color: rgba(255,255,255,.55); letter-spacing: .5px;
}
.nav-links {
  display: flex; align-items: center; gap: .25rem;
  flex-wrap: wrap; flex: 1;
}
.nav-links a {
  color: rgba(255,255,255,.78);
  font-family: var(--font);
  font-size: .82rem; font-weight: 600;
  padding: .38rem .85rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-links a:hover { background: rgba(255,255,255,.12); color: white; }
.nav-links a.active { background: var(--brand); color: white; }
.nav-cta {
  margin-left: auto; flex-shrink: 0;
  background: var(--brand);
  color: white !important;
  font-family: var(--font);
  font-size: .82rem; font-weight: 700;
  padding: .45rem 1.1rem !important;
  border-radius: 6px;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--brand-dk) !important; }

/* ── HERO VARIANTS ── */
.page-hero {
  background: linear-gradient(135deg, var(--dark) 0%, #2D2D5E 100%);
  padding: 3.5rem 2rem 2.5rem;
  text-align: center; position: relative; overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.page-hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.page-hero h1 {
  font-family: var(--font);
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 900; color: white;
  line-height: 1.15; margin-bottom: .75rem;
}
.page-hero h1 span { color: var(--gold); }
.page-hero p { color: rgba(255,255,255,.75); font-size: 1.05rem; }
.hero-badge {
  display: inline-block;
  background: var(--brand); color: white;
  font-family: var(--font); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: .3rem .9rem; border-radius: 999px;
  margin-bottom: .9rem;
}

/* ── CONTAINERS ── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 3.5rem 0; }
.section-sm { padding: 2rem 0; }
.section-title {
  font-family: var(--font);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800; margin-bottom: .5rem;
  color: var(--dark);
}
.section-sub { color: var(--mid); font-size: .97rem; margin-bottom: 2rem; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card-img { width: 100%; height: 180px; object-fit: cover; background: var(--light); }
.card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.card-tag {
  font-family: var(--font); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: .2rem .6rem; border-radius: 4px; width: fit-content;
}
.card-title { font-family: var(--font); font-size: 1.1rem; font-weight: 700; color: var(--dark); }
.card-desc { font-size: .88rem; color: var(--mid); flex: 1; }
.card-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--font); font-weight: 700; font-size: .9rem;
  padding: .65rem 1.5rem; border-radius: var(--radius);
  border: none; cursor: pointer; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dk); color: white; text-decoration: none; transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #1a5cc8; color: white; text-decoration: none; }
.btn-outline { background: transparent; color: var(--dark); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--dark); }
.btn-gold:hover { background: #e0950f; color: var(--dark); text-decoration: none; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; }
.btn-sm { padding: .4rem 1rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* ── GRIDS ── */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5rem; }

/* ── AD PLACEHOLDER (AdSense eligible structure) ── */
.ad-slot {
  background: #f0f0f5;
  border: 1px dashed #ccc;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #aaa; font-size: .8rem; font-weight: 600;
  text-align: center; overflow: hidden;
}
.ad-slot-leaderboard { width: 100%; height: 90px; }
.ad-slot-rectangle { width: 300px; height: 250px; }
.ad-slot-banner { width: 100%; height: 60px; }

/* ── DOWNLOAD CARDS ── */
.download-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex; gap: 1.25rem; align-items: flex-start;
  transition: transform var(--transition), box-shadow var(--transition);
}
.download-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.download-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.download-info { flex: 1; }
.download-title { font-family: var(--font); font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.download-meta { font-size: .8rem; color: var(--mid); margin-bottom: .75rem; }

/* ── FLASHCARD ── */
.flashcard-wrap { perspective: 1000px; height: 220px; cursor: pointer; }
.flashcard { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.flashcard-wrap.flipped .flashcard { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: .5rem; padding: 1.5rem;
  text-align: center; box-shadow: var(--shadow);
}
.flashcard-back { transform: rotateY(180deg); }
.flashcard-q { font-family: var(--font); font-size: 1.8rem; font-weight: 900; }
.flashcard-hint { font-size: .78rem; font-weight: 600; opacity: .6; }
.flashcard-ans { font-family: var(--font); font-size: 2.4rem; font-weight: 900; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; gap: .4rem; align-items: center;
  font-size: .8rem; color: var(--mid);
  padding: .75rem 0;
}
.breadcrumb a { color: var(--mid); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { opacity: .4; }

/* ── FOOTER ── */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,.65);
  padding: 3rem 2rem 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem; max-width: 1160px; margin: 0 auto 2rem;
}
.footer-brand { display: flex; flex-direction: column; gap: .75rem; }
.footer-brand-logo { display: flex; align-items: center; gap: .6rem; }
.footer-brand-logo .mark {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 900; color: white; font-family: var(--font);
}
.footer-brand-name { font-family: var(--font); font-weight: 800; color: white; font-size: .95rem; }
.footer-desc { font-size: .84rem; line-height: 1.6; }
.footer-col h4 { font-family: var(--font); font-weight: 700; color: white; font-size: .88rem; margin-bottom: .85rem; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.footer-col ul li a { color: rgba(255,255,255,.6); font-size: .83rem; text-decoration: none; transition: color var(--transition); }
.footer-col ul li a:hover { color: white; }
.footer-bottom {
  max-width: 1160px; margin: 0 auto;
  padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .75rem;
  font-size: .78rem;
}
.footer-bottom a { color: rgba(255,255,255,.5); }
.footer-bottom a:hover { color: white; }

/* ── UTILS ── */
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; } .justify-center { justify-content: center; }
.chip {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .22rem .7rem; border-radius: 999px;
  font-family: var(--font);
}

/* ── RESPONSIVE ── */
@media(max-width:900px){
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media(max-width:600px){
  .footer-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .download-card { flex-direction: column; }
  .site-nav { padding: 0 1rem; }
}
