/* Teacher Toolbox — the site around the tools (page mode, not board mode).
   board.css is loaded first and owns fonts, the rem scale, and touch sizes. */

body.page {
  background: linear-gradient(180deg, #f7fafd 0%, #eaf2fb 100%);
  color: var(--ink);
}

body.centred {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.wrap {
  width: min(100%, 62rem);
  margin: 0 auto;
  padding: 1.5rem 1.2rem 4rem;
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: max(1.9rem, 3.2vw);
  line-height: 1.05;
  margin: 0 0 0.4rem;
}

h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: max(1.4rem, 2.2vw);
  margin: 0;
}

.note {
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.5;
  margin: 0.4rem 0 0;
}

.err {
  color: var(--warn);
  font-weight: 800;
  margin: 0.6rem 0 0;
}

a {
  color: #0070c0;
}

/* ------------------------------------------------------------------ header */

.site {
  display: flex;
  align-items: center;
  gap: var(--hit-gap);
  flex-wrap: wrap;
  padding: 0.7rem 1.2rem;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid #dbe6f2;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: max(1.1rem, 1.5vw);
}

.brand__mark {
  font-size: 1.4em;
}

.site__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--hit-gap);
  flex-wrap: wrap;
}

.who {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: var(--t-meta);
}

.classpick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: var(--t-meta);
  color: var(--ink-soft);
}

/* -------------------------------------------------------------------- hero */

.hero {
  width: min(100%, 62rem);
  margin: 0 auto;
  padding: 2rem 1.2rem 0.5rem;
}

.hero h1 {
  font-size: max(2.1rem, 3.8vw);
}

.hero p {
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.55;
  font-size: max(1rem, 1.2vw);
  margin: 0.6rem 0 0;
  max-width: 44rem;
}

.hero__note {
  font-weight: 800;
}

/* ----------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 800;
  min-height: var(--hit);
  padding: 0.5rem 1rem;
  border-radius: 0.7rem;
  border: 2px solid #d8e4f0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn:hover {
  background: #f2f7fd;
}
.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: #0070c0;
  border-color: #0070c0;
  color: #fff;
}
.btn--primary:hover {
  background: #005ea3;
}

.btn--danger {
  background: #fff;
  border-color: #e9b9ba;
  color: var(--warn);
}
.btn--danger:hover {
  background: #fff2f2;
}

.btn--quiet {
  background: #eef4fb;
  border-color: #dde7f2;
}

.btn--wide {
  width: 100%;
  margin-top: 0.4rem;
}

/* ------------------------------------------------------------------- cards */

.card {
  background: #fff;
  border: 1px solid #dfe9f4;
  border-radius: var(--radius);
  box-shadow: 0 0.25rem 0.9rem rgba(31, 51, 82, 0.07);
  padding: 1.1rem;
  margin: 0.8rem 0;
}

.card--slim {
  width: min(100%, 34rem);
}

.card--row {
  display: flex;
  align-items: center;
  gap: var(--hit-gap);
  flex-wrap: wrap;
  justify-content: space-between;
}

body.centred .card {
  width: min(100%, 26rem);
}

label {
  display: block;
  font-weight: 800;
  margin: 0.7rem 0 0;
  font-size: var(--t-meta);
  color: var(--ink-soft);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='tel'],
textarea,
select {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  width: 100%;
  min-height: var(--hit);
  padding: 0.5rem 0.7rem;
  margin-top: 0.25rem;
  border: 2px solid #d8e4f0;
  border-radius: 0.6rem;
  background: #fff;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

details summary {
  cursor: pointer;
  font-weight: 800;
  margin-top: 0.9rem;
  color: #0070c0;
  min-height: var(--hit);
  display: flex;
  align-items: center;
}

/* ------------------------------------------------------------------ roster */

.roster {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.roster li {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.roster li input {
  flex: 1 1 auto;
  margin-top: 0;
}

.roster li select {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
}

.roster li .btn {
  flex: 0 0 auto;
  min-width: var(--hit);
  padding: 0.3rem 0.6rem;
}

/* --------------------------------------------------------------- catalogue */

.catalogue {
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: 1rem 1.2rem 4rem;
}

.loading {
  color: var(--ink-soft);
  font-weight: 700;
  padding: 2rem 0;
}

.tool {
  margin: 2.4rem 0 0;
}

.tool__head {
  display: flex;
  gap: var(--hit-gap);
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.tool__desc {
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.5;
  margin: 0.25rem 0 0;
  max-width: 44rem;
}

.versions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.vcard {
  background: #fff;
  border: 2px solid #e3ecf6;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0.25rem 0.9rem rgba(31, 51, 82, 0.07);
}

.vcard.is-loved {
  border-color: #ffb3d4;
  box-shadow: 0 0.3rem 1.1rem rgba(255, 47, 146, 0.16);
}

/* The live preview. A real running tool, scaled down — not a screenshot. */
.vcard__stage {
  position: relative;
  background: #eaf2fb;
}

.vcard__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

/* Render the preview at real board dimensions and scale it down, so it reads as
   a miniature board. Sized to the iframe instead, a board-mode tool derives its
   rem scale from a 300px viewport and everything comes out looking zoomed in. */
.vcard__frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  display: block;
  transform: scale(var(--shrink, 0.25));
  transform-origin: 0 0;
}

.vcard__idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: var(--t-meta);
}

.vcard__open {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  font: inherit;
  font-weight: 800;
  min-height: var(--hit);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 112, 192, 0.95);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}

.vcard__foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-top: 1px solid #eef4fb;
}

.vcard__label {
  font-family: var(--font-display);
  font-weight: 800;
  flex: 1 1 auto;
}

.tag {
  font-size: var(--t-meta);
  font-weight: 800;
  color: var(--ink-soft);
  background: #eef4fb;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.heart {
  min-width: var(--hit);
  min-height: var(--hit);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: #c8d5e4;
  touch-action: manipulation;
}

.vcard.is-loved .heart {
  color: var(--accent);
}

/* ------------------------------------------------------------------ modals */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 36, 60, 0.5);
}

.modal__panel {
  position: relative;
  width: min(34rem, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1rem 3rem rgba(15, 30, 55, 0.4);
  padding: 1.2rem;
}

.modal__row {
  display: flex;
  gap: var(--hit-gap);
  justify-content: flex-end;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.8rem 0 0.2rem;
}

.chip {
  margin: 0;
  font-size: var(--t-meta);
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 2px solid #dde7f2;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  color: var(--ink-soft);
}

.chip input:checked + span {
  border-color: #0070c0;
  color: #0070c0;
  background: #eef6fd;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  max-width: 92vw;
  text-align: center;
}

.site-foot {
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: var(--t-meta);
  padding: 2rem 1rem 3rem;
}

/* -------------------------------------------------------- the gentle nudge
   A bar, not a modal. It has to be ignorable — a teacher who feels ambushed
   learns to dismiss without reading, and then we get no feedback at all. */

.nudge {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 90;
  width: min(44rem, 94vw);
  display: flex;
  align-items: center;
  gap: var(--hit-gap);
  flex-wrap: wrap;
  justify-content: space-between;
  background: #fff;
  border: 2px solid #d9e6f5;
  border-radius: 999px;
  box-shadow: 0 0.6rem 1.8rem rgba(31, 51, 82, 0.18);
  padding: 0.55rem 0.7rem 0.55rem 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 34rem) {
  .nudge {
    border-radius: var(--radius);
    justify-content: center;
    text-align: center;
  }
}

/* ------------------------------------------------------- name style picker */

.namestyle {
  border: 2px solid #dde7f2;
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem 0.3rem;
  margin: 1rem 0 0;
}

.namestyle legend {
  font-weight: 800;
  font-size: var(--t-meta);
  color: var(--ink-soft);
  padding: 0 0.35rem;
}

.pick {
  display: block;
  margin: 0 0 0.4rem;
  cursor: pointer;
}

.pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pick span {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-height: var(--hit);
  padding: 0.4rem 0.8rem;
  border: 2px solid #e6eef7;
  border-radius: 0.6rem;
  background: #fff;
}

.pick b {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.pick small {
  color: var(--ink-soft);
  font-weight: 700;
}

.pick input:checked + span {
  border-color: #0070c0;
  background: #eef6fd;
}

/* -------------------------------------------------------- version history */

.vhist {
  border-top: 1px solid #eef4fb;
  padding: 0.5rem 0.8rem;
}

.vhist summary {
  cursor: pointer;
  font-weight: 800;
  font-size: var(--t-meta);
  color: var(--ink-soft);
  min-height: var(--hit);
  display: flex;
  align-items: center;
}

.vhist ul {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.vhist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--ink-soft);
}

.vhist li span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vhist a {
  font-weight: 800;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  background: #eef4fb;
}

.newest {
  font-size: var(--t-meta);
  font-weight: 800;
  color: #0a7d3f;
  background: #e6f7ee;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

/* A rough draft stays browsable but says so, so nobody puts one on a board
   in front of a class expecting it to work. */
.draftTag {
  font-style: normal;
  font-weight: 800;
  font-size: var(--t-meta);
  color: #8a5a00;
  background: #fff4d6;
  border: 1px solid #ffdf8f;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  flex: 0 0 auto;
}

/* Remove is deliberately the quietest thing in the row — it should be findable
   but never the obvious next tap. */
.vhist a.rm { background: #fdeeee; color: #b1443f; }
.vhist li.isGone { opacity: 0.65; }
.vhist li.isGone span { text-decoration: line-through; }

.draftTag.isBroken { color: #a3302b; background: #fdeaea; border-color: #f3c0be; }

/* The note is the bit that actually tells you which version to go back to,
   so it gets the room a date doesn't need. */
.vhist .vnote {
  font-style: normal;
  font-weight: 700;
  color: var(--ink-soft);
  flex: 1 1 12rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
