/* The Year 1 phonics check practice (templates/phonics.html).

   practice.css draws the page of reading; this file adds the run: the big
   word card a child reads from, the two keys a parent taps, the result table
   and the printable sheet. The keys are large because a parent taps them
   while watching the child, not the screen. Nothing here animates. */

.ph [hidden] { display: none !important; }

/* ------------------------------------------------------------------ the steps */

.ph-steps { max-width: 40em; margin: 22px 0 0; padding-left: 1.4em; display: grid; gap: 12px; }
.ph-steps em { font-style: normal; font-weight: 700; color: var(--pen); }
.ph-set { font: 700 1em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ------------------------------------------------------------------ the run */

.ph-begin, .ph-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 22px 0 0;
}
.ph-key { min-height: 64px; padding: 0.6rem 1.6rem; font-size: 1.2rem; }
.ph-keys .ph-key { flex: 1 1 14rem; }
.ph-begin .key-start { border-color: var(--start-edge); }
.ph-key-right { border-color: var(--start-edge); }

.ph-stage { margin-top: 22px; }
.ph-progress { margin: 0; font-weight: 700; color: var(--ink-soft); }

/* The card: one word, very large, in the plain print face. A made-up word
   has its creature on the left, so a child reads left to right from it. */
.ph-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 28px;
  min-height: 11rem;
  margin: 14px 0 0;
  padding: 24px 20px;
  background: var(--slip);
  border: 2px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--slip-shadow);
}
.ph-creature { flex: none; width: 88px; height: 88px; }
.ph-word {
  flex: 0 1 auto;
  margin: 0;
  font-family: "Learnest Plain Zero", var(--f-print);
  font-size: clamp(3.6rem, 4rem + 6vw, 7.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ph-kind { flex: 1 0 100%; margin: 0; text-align: center; font-size: 0.95rem; color: var(--ink-soft); }

.ph-tools { display: flex; flex-wrap: wrap; gap: 0 26px; margin: 10px 0 0; }
.ph-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0;
  font: 700 1rem var(--f-print);
  color: var(--pen);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  cursor: pointer;
}

/* ------------------------------------------------------------------ the result */

.ph-results { margin-top: 28px; }
.ph-score { margin: 0; font-size: clamp(1.7rem, 1.25rem + 1.3vw, 2.35rem); line-height: 1.1; }
.ph-stopped { margin: 10px 0 0; color: var(--ink-soft); }
.ph-table {
  width: 100%;
  margin: 22px 0 0;
  border-collapse: collapse;
  font-size: 1rem;
}
.ph-table caption { text-align: left; font-weight: 700; padding: 0 0 8px; }
.ph-table th, .ph-table td { padding: 10px 8px; border-bottom: 1px solid var(--ink-soft); text-align: left; vertical-align: top; }
.ph-table thead th { border-bottom: 2px solid var(--rule); font-size: 0.9rem; color: var(--ink-soft); }
.ph-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ph-table tbody th { font-weight: 400; }
.ph-row-section th, .ph-row-section td { font-weight: 700; background: var(--tint); }
.ph-results h3 + .ph-table { margin-top: 18px; }
.ph-results h3 { margin: 28px 0 0; font-size: 1.3rem; }
.ph-results h3 + p { margin-top: 10px; }
.ph-next { margin: 14px 0 0; padding-left: 1.3em; display: grid; gap: 16px; max-width: 40em; }
.ph-next-head { margin: 0; }
.ph-next ul { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
.ph-activities { margin: 0 0 18px; padding-left: 1.2em; display: grid; gap: 8px; max-width: 40em; }

/* ------------------------------------------------------------------ the sheet */

.ph-sheet { margin-top: 28px; }
.ph-sheet-h { margin: 26px 0 0; font-size: 1.15rem; }
.ph-grid {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.ph-cell {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 10px;
  background: var(--slip);
  border: 1px solid var(--ink-soft);
  border-radius: 10px;
}
.ph-cell-no { font-size: 0.85rem; color: var(--ink-soft); min-width: 1.4em; }
.ph-cell-word { font-family: "Learnest Plain Zero", var(--f-print); font-size: 1.5rem; font-weight: 700; white-space: nowrap; }
.ph-creature-small { width: 30px; height: 30px; }
.ph-tick { width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 4px; }
.ph-marking td, .ph-marking th { font-size: 0.95rem; }

@media (min-width: 540px) {
  .ph-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .ph-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .ph-card { padding: 20px 12px; }
  .ph-creature { width: 64px; height: 64px; }
  .ph-cell-word { font-size: 1.3rem; }
}

@media (prefers-color-scheme: dark) {
  .ph-cell, .ph-card { border-color: var(--ink-soft); }
}

@media (prefers-reduced-motion: reduce) {
  .ph-key, .ph-key:active, .ph-link { transition: none; }
}

/* ------------------------------------------------------------------ paper

   Print shows only the run: the result once there is one, or the sheet. */
@media print {
  body.pub { background: #fff; color: #000; }
  .nav, .back, .ph-noprint, .skip, .pen-marks { display: none !important; }
  .ph > :not(.ph-practice) { display: none !important; }
  .ph-practice h2 { font-size: 1.3rem; }
  .ph-card, .ph-cell { box-shadow: none; border-color: #000; }
  .ph-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ph-cell { break-inside: avoid; }
  .ph-table th, .ph-table td { border-color: #000; }
  .ph-row-section th, .ph-row-section td { background: #eee; }
}
