/* ============================================================
   Jugnu Jar — stories: the library and the reader
   ============================================================ */

/* ---------- the library ---------- */

.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(680px, 100%);
  margin: 0 auto;
}

/* A wide row rather than a tile: a story is picked by its name, and names do
   not fit in a square. */
.story-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-1);
  text-align: left;
  transition: transform .12s ease;
}
.story-card:active { transform: scale(.97); }
.story-card.done { box-shadow: var(--shadow-1), inset 0 0 0 3px var(--c-good); }

.story-card-art {
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1;
  width: 1.4em;
  text-align: center;
}

/* Grid children default to min-width:auto, so a long title would set a floor
   the column cannot shrink past and push the card wider than the screen. */
.story-card-words { min-width: 0; }

.story-card-title {
  font-weight: 900;
  font-size: clamp(15px, 3.9vw, 19px);
  color: var(--c-ink);
  line-height: 1.2;
}
.story-card-hook {
  font-size: clamp(12px, 3.2vw, 14px);
  color: var(--c-ink-soft);
  margin-top: 2px;
}

.story-card-stars {
  display: flex;
  gap: 1px;
  font-size: 13px;
  flex: 0 0 auto;
}
.story-card-stars .star { opacity: .25; filter: grayscale(1); }
.story-card-stars .star.on { opacity: 1; filter: none; }

/* ---------- the reader ---------- */

.story-screen { --story-hue: 260; }

.story-head {
  width: min(640px, 100%);
  margin: 0 auto 4px;
  text-align: center;
}

.story-title {
  color: #fff;
  font-size: clamp(22px, 5.6vw, 32px);
  line-height: 1.2;
  margin: 0 0 6px;
  text-shadow: 0 2px 0 rgba(45, 33, 80, .3);
}
.story-hook {
  color: rgba(255, 255, 255, .85);
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 700;
  margin: 0 0 16px;
}

.story-listen {
  display: block;
  margin: 0 auto 18px;
  padding: 12px 24px;
  font-size: clamp(15px, 3.8vw, 18px);
}
.story-listen.on { background: var(--c-good); color: #fff; }

/* One card of continuous prose. Generous line height and a measure of about
   fifty characters, because at this age line spacing and line length do more
   for fluency than font size does. */
.story-prose {
  width: min(640px, 100%);
  margin: 0 auto;
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 22px 20px 6px;
  border-top: 6px solid hsl(var(--story-hue) 70% 70%);
}

.story-para {
  color: var(--c-ink);
  font-size: clamp(16px, 4.1vw, 19px);
  line-height: 1.75;
  margin: 0 0 18px;
  text-align: left;
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
}

/* The paragraph being read aloud.

   This is a place-marker, not a spotlight. Its whole job is to answer "where
   are we?" at a glance and then get out of the way, because the child is
   trying to read the words inside it.

   So: a bar down the left edge, which is what the eye actually uses to find
   its place, and a tint faint enough to be felt rather than looked at. Both
   are drawn with an inset shadow rather than a border or padding, so turning
   the highlight on cannot move a single letter.

   Deliberately absent: any animation, any fade, any change of size. An earlier
   version reused the global .speaking class and inherited a 110% scale pulse
   that ran twice a second for the length of the paragraph — unreadable. The
   one before that added a six-pixel spread shadow, which made the block grow
   and shrink as the reading moved down the page. */
.story-para.now-reading {
  background: hsl(var(--story-hue) 72% 97%);
  box-shadow: inset 3px 0 0 hsl(var(--story-hue) 58% 76%);
}

.story-finish {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: 22px 0 8px;
  text-align: center;
}
.story-end-mark {
  color: rgba(255, 255, 255, .7);
  font-size: 26px;
  line-height: 1;
  margin-bottom: 16px;
}

/* ---------- the questions ---------- */

.story-lesson {
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: clamp(14px, 3.6vw, 17px);
  line-height: 1.5;
  margin: 0 auto 22px;
  max-width: 34ch;
  text-shadow: 0 2px 0 rgba(45, 33, 80, .28);
}

.story-ask {
  color: #fff;
  text-align: center;
  font-size: clamp(18px, 4.6vw, 26px);
  line-height: 1.35;
  margin: 6px auto 18px;
  max-width: 24ch;
  text-shadow: 0 2px 0 rgba(45, 33, 80, .28);
}

.story-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(520px, 100%);
  margin: 0 auto;
}

/* Answers are sentences, so they stack rather than sitting two-by-two: half a
   phone's width turns "He was still worrying about his homework" into five
   cramped lines. */
.story-option {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-1);
  font-size: clamp(15px, 3.9vw, 18px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--c-ink);
  text-align: left;
  transition: transform .12s ease, background .12s ease;
}
.story-option:active { transform: scale(.97); }
.story-option.right { background: var(--c-good); color: #fff; }
.story-option.wrong { background: var(--c-oops); color: #fff; }

.story-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 14px 12px 4px;
}
.story-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
}
.story-dots i.hit { background: var(--c-good); }
.story-dots i.miss { background: var(--c-oops); }

@media (min-width: 720px) {
  .story-grid { grid-template-columns: 1fr 1fr; }
  .story-prose { padding: 28px 30px 10px; }
}
