/*
Theme Name: ImdbFan2 Crayon
Theme URI: https://imdbfan2.in/
Author: ImdbFan2
Description: A playful, hand-drawn "crayon scrapbook" theme built for kids' coloring, audio-learning and games content. Warm paper background, rounded crayon-color accents, and taped scrapbook-style content cards.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: imdbfan2-crayon
*/

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
  /* Colors */
  --paper: #FFF8ED;
  --paper-soft: #FFFDF7;
  --cloud: #FFFFFF;
  --ink: #34262E;
  --ink-soft: #6B5B63;
  --line: #E8DFC8;

  --coral: #FF6B5B;
  --coral-dark: #E5503F;
  --sunshine: #FFC847;
  --sunshine-dark: #E5A800;
  --teal: #21BF9B;
  --teal-dark: #17967A;
  --grape: #8B5FBF;
  --grape-dark: #6E469B;

  /* Type */
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;

  /* Rhythm */
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 0 rgba(52, 38, 46, 0.06), 0 16px 30px rgba(52, 38, 46, 0.08);
  --shadow-pop: 0 6px 0 rgba(52, 38, 46, 0.12);
  --container: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(52,38,46,0.05) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink);
}

a { color: var(--grape-dark); text-decoration: none; }
a:hover { color: var(--coral-dark); }

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Focus visibility for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--teal-dark);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ==========================================================================
   2. Signature element: crayon scribble underline
   ========================================================================== */

.crayon-heading { position: relative; display: inline-block; }
.crayon-heading .scribble {
  display: block;
  width: 100%;
  height: 14px;
  margin-top: 2px;
}
.crayon-heading .scribble path {
  fill: none;
  stroke: var(--coral);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  transition: stroke-dashoffset 0.9s ease;
}
.crayon-heading.in-view .scribble path { stroke-dashoffset: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--teal-dark);
  background: rgba(33, 191, 155, 0.12);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ==========================================================================
   3. Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper-soft);
  border-bottom: 3px dashed var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-branding__mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cloud);
  transform: rotate(-6deg);
  box-shadow: var(--shadow-pop);
  flex-shrink: 0;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
  color: var(--ink);
}
.site-title a { color: inherit; }
.site-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: var(--sunshine);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
}

.primary-menu {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.primary-menu li { position: relative; }

.primary-menu a {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  transition: background 0.2s ease, transform 0.15s ease;
}

.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a {
  background: var(--sunshine);
  transform: translateY(-2px);
}

.primary-menu ul {
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--cloud);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 8px;
  min-width: 200px;
  display: none;
  margin: 4px 0 0;
}
.primary-menu li:hover > ul { display: block; }
.primary-menu ul a { padding: 8px 12px; border-radius: 8px; }
.primary-menu ul a:hover { background: var(--paper); }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .primary-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper-soft);
    padding: 12px 24px 20px;
    border-bottom: 3px dashed var(--line);
  }
  .primary-menu.is-open { display: flex; }
  .primary-menu ul { position: static; box-shadow: none; display: block; }
}

/* ==========================================================================
   4. Hero
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--coral);
  margin: 24px;
  border-radius: var(--radius-lg);
  padding: 64px 32px;
  text-align: center;
  color: var(--cloud);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.18;
  background: var(--cloud);
}
.hero::before { width: 220px; height: 220px; top: -80px; left: -60px; }
.hero::after { width: 160px; height: 160px; bottom: -70px; right: -40px; }

.hero__eyebrow {
  font-family: var(--font-display);
  background: rgba(255,255,255,0.22);
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.hero h1 {
  color: var(--cloud);
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 720px;
  margin: 0 auto 16px;
}

.hero p {
  max-width: 560px;
  margin: 0 auto 28px;
  font-size: 1.15rem;
  font-weight: 700;
  opacity: 0.95;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn--sunshine {
  background: var(--sunshine);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--sunshine-dark);
}
.btn--sunshine:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--sunshine-dark); color: var(--ink); }
.btn--sunshine:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--sunshine-dark); }

.btn--teal { background: var(--teal); color: var(--cloud); box-shadow: 0 5px 0 var(--teal-dark); }
.btn--teal:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--teal-dark); color: var(--cloud); }

/* ==========================================================================
   5. Sections & scribble dividers
   ========================================================================== */

.section { padding: 56px 24px; }
.section__head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section__head p { color: var(--ink-soft); font-weight: 700; }

.section-divider { display: block; width: 100%; height: 30px; margin: 0 auto; }

/* ==========================================================================
   6. Scrapbook cards (signature repeated motif)
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px;
  max-width: var(--container);
  margin: 0 auto;
}

.scrap-card {
  position: relative;
  background: var(--cloud);
  border-radius: var(--radius-md);
  padding: 14px 14px 18px;
  box-shadow: var(--shadow-card);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.scrap-card:nth-child(3n+1) { --tilt: -2deg; }
.scrap-card:nth-child(3n+2) { --tilt: 1.5deg; }
.scrap-card:nth-child(3n+3) { --tilt: -1deg; }

.scrap-card:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 14px 0 rgba(52,38,46,0.06), 0 20px 34px rgba(52,38,46,0.12); }

.scrap-card__tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  width: 70px;
  height: 22px;
  background: var(--sunshine);
  opacity: 0.85;
  border-radius: 3px;
}
.scrap-card:nth-child(3n+2) .scrap-card__tape { background: var(--teal); }
.scrap-card:nth-child(3n+3) .scrap-card__tape { background: var(--grape); }

.scrap-card img { border-radius: var(--radius-sm); aspect-ratio: 1/1; object-fit: cover; }

.scrap-card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 12px 0 4px;
}
.scrap-card__title a { color: var(--ink); }

.scrap-card__meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 6px;
}

.scrap-card__excerpt {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.scrap-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--coral-dark);
}

.section--sunshine { background: rgba(255,200,71,0.16); border-radius: var(--radius-lg); margin: 0 24px; }
.section--teal { background: rgba(33,191,155,0.12); border-radius: var(--radius-lg); margin: 0 24px; }

.more-link-wrap { text-align: center; margin-top: 36px; }

/* ==========================================================================
   7. Single post / page content
   ========================================================================== */

.single-wrap {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 24px;
}

.breadcrumbs {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.breadcrumbs a { color: var(--teal-dark); }

.entry-header { margin-bottom: 20px; }
.entry-title { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.entry-meta { font-size: 0.9rem; color: var(--ink-soft); font-weight: 700; }
.entry-meta .tag {
  display: inline-block;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  margin-right: 6px;
  font-size: 0.8rem;
}

.entry-content {
  background: var(--cloud);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.entry-content p { margin: 0 0 1.1em; }
.entry-content h2, .entry-content h3 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content blockquote {
  border-left: 6px solid var(--sunshine);
  margin: 1.5em 0;
  padding: 4px 20px;
  background: var(--paper);
  border-radius: 0 12px 12px 0;
  font-style: italic;
}

.audio-panel {
  background: var(--grape);
  color: var(--cloud);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
}
.audio-panel__icon { font-size: 1.6rem; }
.audio-panel audio { width: 100%; }

.fact-box {
  background: var(--paper);
  border: 3px dashed var(--sunshine-dark);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 20px 0;
}
.fact-box__title {
  font-family: var(--font-display);
  color: var(--coral-dark);
  margin-bottom: 6px;
}

.related-heading { margin: 40px 0 20px; }

/* ==========================================================================
   8. Footer
   ========================================================================== */

.site-footer {
  margin-top: 40px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 44px 24px 28px;
}
.site-footer a { color: var(--sunshine); }
.site-footer .site-branding__mark { background: var(--sunshine); color: var(--ink); }
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 0; font-weight: 700; }
.footer-note { width: 100%; text-align: center; margin-top: 28px; font-size: 0.85rem; opacity: 0.75; }

/* ==========================================================================
   8b. Interactive coloring tool
   ========================================================================== */

.coloring-tool {
  background: var(--paper);
  border: 3px dashed var(--sunshine-dark);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 24px 0;
}

.coloring-tool__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.coloring-tool__palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coloring-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--cloud);
  box-shadow: 0 0 0 2px var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}
.coloring-swatch:hover { transform: scale(1.1); }
.coloring-swatch.is-active { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.12); }

.coloring-tool__custom {
  width: 40px;
  height: 34px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: none;
}

.coloring-tool__actions { display: flex; gap: 10px; margin-left: auto; }

.coloring-tool__undo,
.coloring-tool__reset,
.coloring-tool__download {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.coloring-tool__undo { background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.coloring-tool__reset { background: var(--cloud); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.coloring-tool__download { background: var(--teal); color: var(--cloud); box-shadow: 0 3px 0 var(--teal-dark); }

.coloring-tool__hint {
  text-align: center;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.coloring-tool__canvas {
  display: block;
  background: var(--cloud);
  border-radius: var(--radius-md);
  padding: 12px;
  box-sizing: content-box;
  max-width: 100%;
  margin: 0 auto;
  cursor: crosshair;
  touch-action: none;
}

/* ==========================================================================
   9. Misc / utility
   ========================================================================== */

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  font-family: var(--font-body);
}
.search-form button {
  background: var(--teal);
  color: var(--cloud);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font-display);
  cursor: pointer;
}

@media (max-width: 600px) {
  .hero { margin: 12px; padding: 44px 20px; }
  .section { padding: 40px 16px; }
}
