/* school.html — the chess school. The board is the shared board.css; this file
 * holds the lesson map, the exercise row, and the overlays only the school
 * paints: the stars to collect, a guarding piece, a lit square. Colours come
 * from the theme tokens in styles.css, so every theme gets its own tint. */

/* --- the lesson map ------------------------------------------------------- */

.school-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.school-card {
  position: relative;
  display: grid;
  gap: 4px;
  height: 100%;
  box-sizing: border-box;
  padding: 16px 18px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 16px;
  background: var(--paper-strong);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}

.school-card:hover,
.school-card:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.7);
  transform: translateY(-1px);
}

.school-card strong { font-size: 1.05rem; }
.school-card-blurb { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.school-card-count { margin-top: 6px; color: var(--label-strong); font-size: 0.82rem; font-weight: 700; }

.school-card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent-ink);
  font-weight: 700;
}

.school-card.is-next { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22); }
.school-card.is-done .school-card-number { background: var(--accent); color: var(--gold-text); }

/* --- a lesson ------------------------------------------------------------- */

.school-lesson-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.school-lesson-head h2 { margin: 0; }

.school-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

/* One numbered circle per exercise; a medal fills it in its metal. */
.school-step {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 50%;
  background: var(--paper-strong);
  color: var(--label-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.school-step[aria-current="step"] { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25); }
.school-step[data-medal="3"] { background: #e7c04c; border-color: #b08a1c; color: #3b2c05; }
.school-step[data-medal="2"] { background: #d3d7dc; border-color: #8d949c; color: #2b3036; }
.school-step[data-medal="1"] { background: #d9a273; border-color: #9a6236; color: #3a220e; }

.school-stage {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.school-board-frame { max-width: 440px; }

.school-panel {
  padding: 16px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 14px;
  background: var(--paper-strong);
}

.school-panel h3 { margin: 0 0 8px; font-size: 1.1rem; }
.school-panel p { margin: 0 0 12px; }

.school-prompt {
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
}

/* A written game: "1. e4 e5 2. ♘f3", the move to play next marked. */
.school-prompt.is-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.school-prompt[hidden] { display: none; }
.school-line-pair { white-space: nowrap; }
.school-line-number { color: var(--label-strong); font-weight: 600; }
.school-line-move.is-played { opacity: 0.45; }
.school-line-move.is-current {
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.2);
  box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), 0.6);
}

.school-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

/* A button holds either a piece name or notation (♘f3): its own text sets the
   direction, so notation stays left to right on an Arabic or Urdu page. */
.school-option { min-width: 64px; unicode-bidi: plaintext; }
.school-option[disabled] { opacity: 0.4; cursor: not-allowed; }
.school-option.is-right { border-color: #4f9e4f; background: rgba(79, 158, 79, 0.18); }

.school-panel .school-status { min-height: 1.5em; color: var(--ink); font-weight: 600; }
.school-panel .school-score { color: var(--label-strong); font-size: 0.9rem; font-weight: 700; }

.school-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.school-actions .button { flex: 1 1 140px; }
.school-actions .button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --- board overlays ------------------------------------------------------- */

/* A star to collect: drawn on top of the wood, under nothing (stars stand on
 * empty squares only — tool/verify_school.mjs checks it). */
.school-board .square.is-star::before {
  content: "★";
  position: absolute;
  color: #f2b705;
  font-size: min(9vw, 40px);
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 1;
}

/* The star already says "go here"; the move dot under it would only blur it. */
.school-board .square.is-star.is-target::after { display: none; }

.school-board .square.is-lit { box-shadow: inset 0 0 0 100vmax rgba(75, 150, 230, 0.55); }
.school-board .square.is-good { box-shadow: inset 0 0 0 100vmax rgba(79, 158, 79, 0.6); }
.school-board .square.is-threat { box-shadow: inset 0 0 0 4px rgba(214, 48, 48, 0.95); }

@media (max-width: 900px) {
  .school-stage { grid-template-columns: minmax(0, 1fr); }
  .school-board-frame { max-width: 440px; width: 100%; margin: 0 auto; }
}

.school-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* The map in parts: pieces, rules, first tricks. */
.school-parts { margin: 18px 0 0; padding: 0; list-style: none; }
.school-part + .school-part { margin-top: 26px; }
.school-part h3 { margin: 0; color: var(--label-strong); font-size: 1.05rem; }
.school-part .school-cards { margin-top: 12px; }

.school-option { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.school-tray-piece { width: 26px; height: 26px; }
