/* Cookie Club — news.eaiz.net
   Brand: Blue (#4A90D9), Pink (#E88BA7), Helium mascot
   6 reading levels: Preschool → Kindergarten → Elementary → Middle → High → Adult
   Mobile-first, playful but polished */

:root {
  --blue: #4A90D9;
  --blue-light: #7AB3E8;
  --blue-dark: #2E6CB5;
  --pink: #E88BA7;
  --pink-light: #F2B5C8;
  --pink-dark: #D06A8A;
  --purple: #9B6DD7;
  --teal: #4ECDC4;
  --bg: #FAFCFF;
  --bg-card: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-muted: #B2BEC3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(74, 144, 217, 0.08);
  --shadow-hover: 0 8px 30px rgba(74, 144, 217, 0.15);
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Baloo 2', 'Nunito', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.site-header {
  background: white;
  border-bottom: 3px solid var(--blue);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.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.6rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(74, 144, 217, 0.3);
  transition: transform var(--transition);
}

.logo:hover .logo-img {
  transform: rotate(-5deg) scale(1.1);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-cookie {
  font-size: 1.4rem;
  animation: cookie-wobble 3s ease-in-out infinite;
}

@keyframes cookie-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(8deg); }
  75% { transform: rotate(-8deg); }
}

/* ===== AGE SWITCHER ===== */
.age-switcher {
  display: flex;
  gap: 0.25rem;
  background: #F0F4F8;
  padding: 3px;
  border-radius: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.age-switcher::-webkit-scrollbar { display: none; }

.age-btn {
  border: none;
  background: transparent;
  padding: 0.4rem 0.65rem;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  position: relative;
}

.age-btn:hover {
  background: rgba(255,255,255,0.7);
  color: var(--text);
}

.age-btn.active {
  background: white;
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.2);
  transform: scale(1.02);
}

.age-btn .age-emoji {
  display: inline-block;
  margin-right: 0.15rem;
}

/* ===== HERO / WELCOME ===== */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero h1 .wave {
  display: inline-block;
  animation: wave-hand 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes wave-hand {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60%, 100% { transform: rotate(0deg); }
}

.hero .tagline {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto;
}

/* ===== HELIUM BALLOON FLOAT ===== */
.he-balloon {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 70px;
  z-index: 50;
  animation: balloon-float 4s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.he-balloon:hover {
  transform: scale(1.15);
}

.he-balloon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(74, 144, 217, 0.25));
}

@keyframes balloon-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

/* ===== ARTICLE GRID ===== */
.articles-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.article-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

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

@media (hover: none) {
  .article-card:hover {
    transform: none;
  }
  .article-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow);
  }
}

.card-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: linear-gradient(135deg, var(--blue-light), var(--pink-light));
}

.card-body {
  padding: 1.1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pink-dark);
  margin-bottom: 0.4rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-reading-level {
  background: linear-gradient(135deg, var(--blue), var(--pink));
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== ARTICLE PAGE ===== */
.article-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  transition: color var(--transition);
}

.article-back:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.article-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pink-dark);
  margin-bottom: 0.5rem;
}

.article-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.article-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article-hero {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== READING LEVEL CONTENT ===== */
.level-content {
  display: none;
}

.level-content.active {
  display: block;
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Level transition indicator */
.level-content.active {
  display: block;
  animation: fade-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Preschool level */
.level-preschool {
  font-size: 1.5rem;
  line-height: 2;
}

.level-preschool p {
  margin-bottom: 1.5rem;
}

.level-preschool .big-emoji {
  display: block;
  font-size: 3rem;
  text-align: center;
  margin: 1rem 0;
}

/* Kindergarten level */
.level-kindergarten {
  font-size: 1.2rem;
  line-height: 1.8;
}

.level-kindergarten p {
  margin-bottom: 1.2rem;
}

.level-kindergarten h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--blue);
  margin: 1.5rem 0 0.75rem;
}

/* Elementary level */
.level-elementary {
  font-size: 1.05rem;
  line-height: 1.7;
}

.level-elementary p {
  margin-bottom: 1rem;
}

.level-elementary h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--blue-dark);
  margin: 1.5rem 0 0.75rem;
}

.fun-fact {
  background: linear-gradient(135deg, #EBF5FF, #FFF0F5);
  border-left: 4px solid var(--blue);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.fun-fact::before {
  content: "🧪 Fun Fact: ";
  font-weight: 700;
  color: var(--blue);
}

/* Middle School level */
.level-middle {
  font-size: 1.02rem;
  line-height: 1.7;
}

.level-middle p {
  margin-bottom: 1rem;
}

.level-middle h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--purple);
  margin: 1.5rem 0 0.75rem;
}

.level-middle .key-concept {
  background: linear-gradient(135deg, #F3EFFF, #EBF5FF);
  border-left: 4px solid var(--purple);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.level-middle .key-concept::before {
  content: "🔑 Key Concept: ";
  font-weight: 700;
  color: var(--purple);
}

.level-middle .math-box {
  background: #F8F9FA;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
}

.level-middle .math-box::before {
  content: "📐 Math Break: ";
  font-weight: 700;
  font-family: var(--font);
  color: var(--text);
  display: block;
  margin-bottom: 0.5rem;
}

/* High School level */
.level-high {
  font-size: 1rem;
  line-height: 1.7;
}

.level-high p {
  margin-bottom: 1rem;
}

.level-high h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal);
  margin: 1.5rem 0 0.75rem;
}

.level-high .deep-dive {
  background: linear-gradient(135deg, #E8FFF8, #EBF5FF);
  border-left: 4px solid var(--teal);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.level-high .deep-dive::before {
  content: "🔬 Deep Dive: ";
  font-weight: 700;
  color: var(--teal);
}

.level-high .equation {
  background: #F8F9FA;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  text-align: center;
}

/* Adult level */
.level-adult {
  font-size: 1rem;
  line-height: 1.7;
}

.level-adult p {
  margin-bottom: 1rem;
}

.level-adult h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
}

.level-adult blockquote {
  border-left: 3px solid var(--blue);
  padding-left: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin: 1.5rem 0;
}

.sources {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E8ECF0;
}

.sources h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sources ol {
  font-size: 0.85rem;
  color: var(--text-light);
  padding-left: 1.5rem;
}

.sources li {
  margin-bottom: 0.4rem;
}

.sources a {
  color: var(--blue);
}

/* ===== INLINE SWITCHER (article page) ===== */
.inline-switcher {
  display: flex;
  gap: 0.35rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.inline-switcher .age-btn {
  background: #F0F4F8;
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
}

.inline-switcher .age-btn.active {
  background: linear-gradient(135deg, var(--blue), var(--pink));
  color: white;
  box-shadow: 0 3px 12px rgba(74, 144, 217, 0.25);
}

/* ===== FOOTER ===== */
.site-footer {
  background: white;
  border-top: 3px solid var(--pink);
  padding: 2rem 1rem;
  text-align: center;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-cookie {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-light);
}

.footer-he {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ===== LEVEL-SPECIFIC BODY STYLES ===== */
/* Subtle environmental shifts per level */
body.current-level-preschool { --bg: #FFFCF7; font-size: 18px; }
body.current-level-kindergarten { --bg: #FAFCFF; font-size: 17px; }
body.current-level-elementary { --bg: #FAFCFF; font-size: 16px; }
body.current-level-middle { --bg: #F8FAFF; font-size: 16px; }
body.current-level-high { --bg: #F7F9FC; font-size: 15.5px; }
body.current-level-adult { --bg: #F8F9FA; font-size: 15.5px; }

/* Focus states for accessibility */
.age-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Scroll hint for horizontal switcher on mobile */
.age-switcher::after {
  content: '';
  display: none;
}

/* ===== EDITORS' NOTE ===== */
.editors-note {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.editors-note-inner {
  background: linear-gradient(135deg, #FFF8E1, #FFF0F5);
  border: 3px dashed var(--pink);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  position: relative;
}

.editors-heading {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--pink-dark);
  margin-bottom: 0.75rem;
}

.editors-message {
  font-family: 'Baloo 2', 'Comic Sans MS', cursive;
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text);
  font-style: italic;
}

.editors-byline {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
  }

  .age-switcher {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    margin-top: 0.5rem;
    padding: 3px 2px;
  }

  .age-btn {
    font-size: 0.68rem;
    padding: 0.35rem 0.55rem;
  }

  .hero h1 { font-size: 1.7rem; }

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

  .article-title { font-size: 1.6rem; }

  .level-preschool { font-size: 1.3rem; }
  .level-kindergarten { font-size: 1.1rem; }

  .he-balloon {
    width: 44px;
    height: 56px;
    right: 12px;
    bottom: 12px;
  }

  .inline-switcher {
    gap: 0.25rem;
  }

  .inline-switcher .age-btn {
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
  }
}

@media (max-width: 480px) {
  .age-btn {
    font-size: 0.62rem;
    padding: 0.3rem 0.45rem;
  }
  
  .logo-text { font-size: 1.2rem; }
  .logo-he { width: 36px; height: 36px; }
  .logo-he-symbol { font-size: 1.1rem; }

  .inline-switcher .age-btn {
    font-size: 0.65rem;
    padding: 0.3rem 0.55rem;
  }
}
