/* ============================================================
   Hope Springs — READ AND DISCOVER stylesheet
   Homework sheets based on Oxford Read and Discover (factual,
   "slightly advanced" kids). Focus: English grammar & structure,
   with photos to support understanding.  NO Japanese in this series.

   Link from a lesson:  <link rel="stylesheet" href="readdiscover.css">
   Fully self-contained — it never touches hopesprings.css (grammar
   lessons) or happyreader.css (Happy Readers). Editing it cannot
   change any other series. Print-ready A4, embedded fonts, exact colour.
   ============================================================ */

/* ---- Reading font: Andika (SIL literacy font), shared fonts/ folder.
        Clear letterforms for a young reader, but grown-up enough for
        factual pages. ---- */
@font-face {
  font-family: "Andika";
  src: url("fonts/Andika-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Andika";
  src: url("fonts/Andika-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --font-read: "Andika", "Segoe UI", "Helvetica Neue", sans-serif;

  /* Oxford Read and Discover palette (coral + friends) */
  --coral:   #e8613c;   /* brand coral — titles, section numbers   */
  --coral-d: #c94a29;   /* darker coral for text on pale coral      */
  --teal:    #1a9aa8;   /* accent — fact box, page numbers          */
  --sun:     #f6b93b;   /* accent — badges                          */
  --leaf:    #52a36b;   /* accent — "true", correct                 */
  --paper:   #fffdf9;   /* warm page                                */
  --ink:     #2b3a42;   /* body text                                */
  --line:    #33474f;   /* writing lines                            */
  --soft:    #fdeee8;   /* pale coral fill (banks, pills)           */
  --soft-b:  #f4c9ba;   /* pale coral border                        */
  --grey:    #eef2f4;   /* neutral pill (circle-the-word options)   */

  /* Type sizes — big, for a 6-year-old reading factual text */
  --t-title: 33pt;
  --t-part:  21pt;
  --t-head:  19pt;
  --t-body:  17.5pt;
  --t-write: 18pt;
  --t-small: 13pt;
}

@page { size: A4 portrait; margin: 0; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-read);
  font-size: var(--t-body);          /* big base — no row falls back to 16px */
  color: var(--ink);
  background: #e9eef2;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  line-height: 1.3;
}
.page {
  position: relative;
  width: 210mm;
  min-height: 292mm;          /* not full 297: avoids a near-empty extra sheet */
  padding: 12mm 14mm 12mm;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.page + .page { page-break-before: always; }

/* ---- Top banner: series ribbon + book title ---- */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 11pt; font-weight: 700; letter-spacing: .5px;
  color: var(--coral); text-transform: uppercase;
  margin-bottom: 6px;
}
.brand::before {
  content: "";
  width: 22px; height: 22px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 2px, transparent 2px),
    var(--teal);
  border: 2px solid #fff; box-shadow: 0 0 0 2px var(--teal);
}
.brand .book { color: var(--ink); text-transform: none; letter-spacing: 0; }

/* ---- Part header: big number circle + part title (matches the book) ---- */
.part {
  display: flex; align-items: center; gap: 14px;
  margin: 2px 0 10px;
}
.part .n {
  flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--coral); color: #fff;
  font-weight: 700; font-size: 27pt;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.part h1 {
  color: var(--coral); font-size: var(--t-title); line-height: 1.02;
  font-weight: 700;
}
/* little "Read pages 10–11" pill, like the activity book */
.readpages {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--soft); color: var(--coral-d);
  border: 2px solid var(--soft-b); border-radius: 999px;
  font-weight: 700; font-size: var(--t-small);
  padding: 3px 12px; margin: 0 0 10px 66px;
}
.readpages::before { content: "\2190"; font-weight: 700; }  /* ← */

/* ---- Exercise header: coral rounded-square number + instruction ---- */
.ex {
  display: flex; align-items: baseline; gap: 10px;
  margin: 14px 0 6px;
}
.ex .no {
  flex: 0 0 auto;
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 8px;
  background: var(--coral); color: #fff;
  font-weight: 700; font-size: 15pt; line-height: 26px;
  text-align: center;
  transform: translateY(3px);
}
.ex .say { font-weight: 700; font-size: var(--t-head); line-height: 1.15; }
.ex .say .hi { color: var(--coral-d); }       /* highlight a target structure */
.ex .tip { font-weight: 400; font-size: var(--t-small); color: #6b7a82; }

/* ---- "Did you know?" fact box (like the book's Discover! bubble) ---- */
.fact {
  display: flex; align-items: center; gap: 12px;
  background: #e7f6f7; border: 2px solid #b7e3e7;
  border-radius: 16px; padding: 8px 13px; margin: 8px 0 3px;
}
.fact .bulb {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 18pt;
  display: flex; align-items: center; justify-content: center;
}
.fact .t { font-size: var(--t-body); }
.fact .t b { color: #0f7580; }

/* ---- Photo grid with coral caption bars (the book's picture labels) ---- */
.photos { display: grid; gap: 10px 12px; margin: 6px 0 2px; }
.photos.c3 { grid-template-columns: repeat(3, 1fr); }
.photos.c2 { grid-template-columns: repeat(2, 1fr); }
.shot { position: relative; }
.shot img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 12px; background: #eef2f5;
  border: 3px solid #fff; box-shadow: 0 0 0 2px #e3d9d2, 0 2px 5px rgba(0,0,0,.1);
}
.shot .cap {
  position: absolute; left: 8px; bottom: 8px;
  background: var(--coral); color: #fff; font-weight: 700;
  font-size: var(--t-small); padding: 3px 10px; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* ---- Exercise 1 style: match words & pictures (numbered photos + bank) ---- */
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px; margin-top: 6px;
}
.grid.fill { flex: 1; align-content: space-between; }
.cell { position: relative; display: flex; flex-direction: column; }
.pic {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 12px; background: #eef2f5;
  border: 3px solid #fff; box-shadow: 0 0 0 2px #e3d9d2;
}
.badge {
  position: absolute; top: -9px; left: -8px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--coral); color: #fff; font-weight: 700; font-size: 16pt;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); z-index: 2;
}
.bank { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 12px; margin-top: 12px; }
.word {
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 2.5px solid var(--soft-b);
  border-radius: 12px; padding: 7px 11px;
  font-size: var(--t-body); font-weight: 700;
}
.word .box {
  flex: 0 0 auto; width: 28px; height: 28px;
  border: 2.5px solid var(--coral); border-radius: 7px; background: var(--soft);
}

/* ---- Word bank strip (for fill-in exercises) ---- */
.wordbox {
  display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center;
  background: var(--soft); border: 2px solid var(--soft-b);
  border-radius: 12px; padding: 8px 14px; margin: 4px 0 10px;
  font-size: var(--t-body); font-weight: 700; color: var(--coral-d);
}

/* ---- Writing lines ---- */
.wl {                                   /* single sentence line */
  border-bottom: 2.5px solid var(--line);
  height: 12mm; margin-top: 3px;
}
.wl.tall { height: 14mm; }
.blank {                                /* short inline write-in blank */
  display: inline-block; min-width: 110px;
  border-bottom: 2.5px solid var(--line);
  height: 1.1em; vertical-align: -4px; margin: 0 4px;
}
.blank.sm { min-width: 64px; }
.numline { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font-size: var(--t-body); line-height: 1.5; }
.numline .qn { font-weight: 700; color: var(--coral-d); flex: 0 0 auto; }
.numline .wl { flex: 1; }

/* light 4-line ruling for single-word writing (young hand) */
.hw {
  margin-top: 6px; height: 13mm; background-repeat: no-repeat;
  background-image:
    repeating-linear-gradient(to right, #e88f7a 0 6px, transparent 6px 12px),
    linear-gradient(var(--line), var(--line)),
    repeating-linear-gradient(to right, #e88f7a 0 6px, transparent 6px 12px),
    linear-gradient(var(--line), var(--line));
  background-size: 100% 2px, 100% 2.2px, 100% 2px, 100% 2.2px;
  background-position: 0 100%, 0 66.66%, 0 33.33%, 0 0;
}

/* ---- Order-the-words / sentence-building rows ---- */
.scram { font-size: var(--t-body); font-weight: 400; margin: 9px 0 0; }
.scram .qn { color: var(--coral-d); font-weight: 700; margin-right: 6px; }
.scram .sep { color: #b9c6cc; font-weight: 400; margin: 0 5px; }
.scram .chunk { white-space: nowrap; }

/* ---- Circle the correct word (two grey option pills) ---- */
.pick { font-size: var(--t-body); font-weight: 400; margin: 9px 0 0; line-height: 1.5; }
.pick .qn { color: var(--coral-d); font-weight: 700; margin-right: 6px; }
.opt {
  display: inline-block; background: var(--grey); border-radius: 999px;
  padding: 2px 12px; margin: 0 2px; font-weight: 700;
}
.pick .or { color: #9aa8ae; font-weight: 400; margin: 0 3px; }

/* ---- True / false ---- (empty box: the child writes the word) ---- */
.tf { font-size: var(--t-body); font-weight: 400; margin: 9px 0 0; display: flex; align-items: center; gap: 10px; }
.tf .qn { color: var(--coral-d); font-weight: 700; flex: 0 0 auto; }
.tf .stmt { flex: 1; }
.tf .tfbox {
  flex: 0 0 auto; width: 34mm; height: 10mm;
  border: 2.5px solid var(--soft-b); border-radius: 8px; background: #fff;
}

/* ---- Match two columns (draw a line) ---- */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 30px; margin-top: 8px; }
.match .col { display: flex; flex-direction: column; gap: 9px; }
.mrow {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 2.5px solid var(--soft-b); border-radius: 12px;
  padding: 8px 11px; font-size: var(--t-body); font-weight: 700;
}
.match .right .mrow { border-color: #b7e3e7; }
.dot { flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--coral); background:#fff; }
.match .right .dot { border-color: var(--teal); margin-left: auto; margin-right: 0; order: 2; }
.match .right .mtext { order: 1; }

/* ---- Structure & targeting ------------------------------------------------
   Each PAGE is a `.page` with an id like `part4-page2` and data-part / data-page.
   Each EXERCISE (its `.ex` header + the items under it) is wrapped in
   `.exercise` with an id like `part4-ex3` and data-ex. So you can target:
     #part4-page2                     -> one page
     [data-part="4"]                  -> everything in Part 4
     #part5-ex3                       -> one exercise
     #part4-page2 .exercise + .exercise { margin-top: 8mm }  -> gap between
                                        exercises on that page
   (Note on `.ex` vs `.exercise`: `.ex` is the little header row — number pill +
    instruction; `.exercise` is the whole block that header belongs to.)
--------------------------------------------------------------------------- */
.exercise { }   /* the wrapper — style/space it via its id or the rules above */

/* Fill the page evenly: exercises spread with equal gaps above, between and
   below, so there is no big blank at the bottom. Adding a margin to one
   `.exercise` still works — it takes its space first, then the rest is shared. */
.fillcol { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.fillcol .exercise .ex { margin-top: 0; }   /* flex controls the between-exercise gap */
.grow { flex: 1; }

/* ---- Footer ---- */
.foot { margin-top: auto; padding-top: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.foot .note { font-size: var(--t-small); color: #7c8a91; }
.foot .note b { color: var(--ink); }
.pageno {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal); color: #fff; font-weight: 700; font-size: 14pt;
  display: flex; align-items: center; justify-content: center;
}

/* roomy rhythm (plenty of space for a 6-year-old's answers) */
.page.tight .ex { margin: 17px 0 7px; }
.page.tight .scram, .page.tight .pick, .page.tight .tf { margin-top: 12px; }
.page.tight .numline { margin-top: 12px; }
.page.tight .part { margin: 2px 0 12px; }
.page.tight .readpages { margin-bottom: 12px; }

@media screen {
  body { padding: 16px; }
  .page { margin: 0 auto 16px; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
}
