/* =============================================
   FractionGames – Main Stylesheet
   Aesthetic: Playful + Educational, warm & bold
   ============================================= */

:root {
  --primary: #f26522;
  --primary-dark: #c94e10;
  --secondary: #4a90d9;
  --accent: #f7c948;
  --accent-green: #3abf7e;
  --bg: #fffbf4;
  --bg-card: #ffffff;
  --text: #1e1a2e;
  --text-muted: #5e5a72;
  --border: #e8e0d5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(242,101,34,0.10);
  --shadow-card: 0 2px 16px rgba(30,26,46,0.09);
  --font-display: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
}

/* ---------- CONTAINER ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- HEADER / NAV ---------- */
.site-header {
  background: #fff;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  background: var(--primary);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 28px;
}
.nav-links a {
  text-decoration: none;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: .3px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: 80px 0 72px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff5ee 0%, #fef3e2 60%, #e8f4ff 100%);
  border-bottom: 2px solid var(--border);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(242,101,34,0.10) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(74,144,217,0.10) 0%, transparent 60%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #7a5200;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: .5px;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 18px;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 18px;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 30px;
}
.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  padding: 14px 36px;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(242,101,34,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(242,101,34,0.40); }

.hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.shape {
  position: absolute;
  font-family: var(--font-display);
  opacity: 0.12;
  color: var(--primary);
  animation: floatShape 6s ease-in-out infinite;
}
.shape-1 { font-size: 5rem; top: 10%; left: 5%; animation-delay: 0s; }
.shape-2 { font-size: 4rem; top: 60%; right: 6%; animation-delay: 2s; }
.shape-3 { font-size: 6rem; bottom: 5%; left: 50%; animation-delay: 4s; }
@keyframes floatShape {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

/* ---------- SECTION COMMON ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--text);
  margin-bottom: 10px;
  text-align: center;
}
.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 36px;
  font-size: 1rem;
}
.btn-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.btn-link:hover { border-bottom-color: var(--primary); }

/* ---------- GAME SECTION ---------- */
.section-game {
  padding: 60px 0;
}
.game-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  background: #fff;
  padding: 16px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-card);
}
.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.control-group label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.control-group select {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  outline: none;
}
.control-group select:focus { border-color: var(--primary); }
.score-board {
  display: flex;
  gap: 20px;
  margin-left: auto;
}
.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.score-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.score-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--primary);
  line-height: 1;
}
.btn-reset {
  background: var(--secondary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-display);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-reset:hover { background: #3278be; transform: scale(1.04); }

.game-area {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow-card);
}
.question-panel {
  text-align: center;
  margin-bottom: 36px;
}
.question-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.fraction-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  border: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 36px;
  animation: popIn 0.4s cubic-bezier(.22,1,.36,1);
}
.frac-num, .frac-den {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--primary);
  line-height: 1;
}
.frac-line {
  display: block;
  width: 60px;
  height: 4px;
  background: var(--primary);
  margin: 6px 0;
  border-radius: 2px;
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.answer-card {
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.18s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.answer-card:hover:not(.disabled) {
  border-color: var(--secondary);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(74,144,217,0.20);
}
.answer-card.correct {
  border-color: var(--accent-green);
  background: #eafaf3;
  animation: bounceCard .4s;
}
.answer-card.wrong {
  border-color: #e94545;
  background: #fff0f0;
  animation: shakeCard .4s;
}
.answer-card.disabled { cursor: not-allowed; opacity: 0.7; }
.card-num, .card-den {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text);
  line-height: 1;
}
.card-line {
  width: 44px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  margin: 4px 0;
}
@keyframes bounceCard {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.feedback-panel {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  min-height: 36px;
  transition: color 0.2s;
}
.feedback-panel.correct { color: var(--accent-green); }
.feedback-panel.wrong   { color: #e94545; }

/* Fraction Visual Bars */
.fraction-visual {
  margin-top: 32px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.visual-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}
.bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.bar-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--primary);
  min-width: 56px;
  text-align: center;
}
.fraction-bar {
  flex: 1;
  height: 36px;
  background: var(--border);
  border-radius: 8px;
  display: flex;
  overflow: hidden;
}
.bar-segment {
  height: 100%;
  border-right: 2px solid rgba(255,255,255,0.7);
  transition: background 0.3s;
}
.bar-segment.filled { background: var(--primary); }
.bar-segment.filled2 { background: var(--secondary); }
.visual-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ---------- HOW IT WORKS ---------- */
.section-how {
  padding: 64px 0;
  background: linear-gradient(180deg, #f0f7ff 0%, var(--bg) 100%);
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-top: 36px;
}
.step-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s;
}
.step-card:hover { transform: translateY(-4px); }
.step-num {
  width: 46px;
  height: 46px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.step-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.step-card p { font-size: 0.9rem; color: var(--text-muted); }

/* ---------- INFO SECTION ---------- */
.section-info {
  padding: 64px 0;
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.info-text h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  margin-bottom: 16px;
}
.info-text p { color: var(--text-muted); margin-bottom: 14px; }
.eq-demo {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  margin-bottom: 14px;
}
.eq-frac {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--primary);
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  box-shadow: var(--shadow-card);
}
.eq-frac hr {
  width: 44px;
  border: none;
  border-top: 3px solid var(--primary);
  margin: 4px 0;
}
.eq-equals {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-muted);
}
.eq-caption {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ---------- BLOG TEASER ---------- */
.section-blog-teaser {
  padding: 64px 0;
  background: linear-gradient(135deg, #fff8e1 0%, #fff 100%);
}
.blog-card-teaser {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 680px;
  margin: 32px auto 0;
  box-shadow: var(--shadow-card);
}
.blog-card-meta {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--secondary);
  margin-bottom: 12px;
}
.blog-card-teaser h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.blog-card-teaser h3 a {
  color: var(--text);
  text-decoration: none;
}
.blog-card-teaser h3 a:hover { color: var(--primary); }
.blog-card-teaser p { color: var(--text-muted); margin-bottom: 16px; font-size: 0.95rem; }

/* ---------- FAQ ---------- */
.section-faq {
  padding: 64px 0;
  background: var(--bg);
}
.faq-list {
  max-width: 720px;
  margin: 36px auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--primary);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  padding: 0 20px 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.8);
  padding: 48px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}
.site-footer .logo { color: #fff; }
.footer-brand p {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.5);
  margin-top: 10px;
  max-width: 280px;
}
.footer-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-nav a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  padding: 18px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.35);
}

/* =============================================
   BLOG STYLES
   ============================================= */
.blog-hero {
  background: linear-gradient(135deg, #e8f4ff 0%, #fff5ee 100%);
  padding: 60px 0 48px;
  border-bottom: 2px solid var(--border);
  text-align: center;
}
.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}
.blog-hero p {
  color: var(--text-muted);
  margin-top: 10px;
}
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 60px 0;
}
.blog-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.blog-card .blog-card-meta { margin-bottom: 10px; }
.blog-card h2 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 10px; }
.blog-card h2 a { color: var(--text); text-decoration: none; }
.blog-card h2 a:hover { color: var(--primary); }
.blog-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; }

/* Article Page */
.article-hero {
  background: linear-gradient(135deg, #fff5ee, #e8f4ff);
  padding: 56px 0 44px;
  border-bottom: 2px solid var(--border);
}
.article-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}
.article-meta {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 20px;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  padding: 56px 0 80px;
  align-items: start;
}
.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 36px 0 14px;
  color: var(--text);
}
.article-content h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 26px 0 10px;
  color: var(--primary);
}
.article-content p {
  color: var(--text-muted);
  margin-bottom: 18px;
  font-size: 1rem;
  line-height: 1.75;
}
.article-content ul, .article-content ol {
  margin: 14px 0 18px 24px;
  color: var(--text-muted);
}
.article-content li { margin-bottom: 8px; }
.placeholder-block {
  background: repeating-linear-gradient(
    135deg,
    #f0f0f0 0px,
    #f0f0f0 10px,
    #f8f8f8 10px,
    #f8f8f8 20px
  );
  border: 2px dashed #ccc;
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  color: #aaa;
  font-size: 0.88rem;
  font-weight: 700;
  margin: 24px 0;
}

/* Sidebar */
.article-sidebar { position: sticky; top: 84px; }
.sidebar-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.sidebar-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 14px;
  color: var(--text);
}
.sidebar-cta {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 28px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.sidebar-cta h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: #fff;
}
.sidebar-cta p { font-size: 0.88rem; color: rgba(255,255,255,0.85); margin-bottom: 16px; }
.btn-cta-white {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 10px 24px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
}
.btn-cta-white:hover { background: var(--accent); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    padding: 16px 24px;
    border-bottom: 2px solid var(--border);
    z-index: 99;
  }
  .menu-toggle { display: block; }
  .info-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .score-board { margin-left: 0; }
  .game-controls { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .answer-grid { grid-template-columns: repeat(2, 1fr); }
  .eq-demo { gap: 10px; }
  .eq-frac { font-size: 1.4rem; padding: 10px 14px; }
}
