/*
 * app.css
 * The tool itself, in the made-by-kev house style:
 * a control panel on the left and the "desk" on the right where the A4 previews sit.
 * Uses only the tokens in tokens.css. Nothing here is printed (see print.css).
 */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--panel);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--check); outline-offset: 2px; }
p { margin: 0; }

/* ---------- Overall layout ---------- */

.app { display: flex; flex-wrap: wrap; min-height: 100dvh; }

.panel {
  /* Fixed width: 420px on desktop, never narrower than 360px (the desk takes the rest) */
  flex: 0 0 clamp(360px, 30vw, 420px);
  height: 100dvh;
  overflow: auto;
  position: sticky;
  top: 0;
  padding: 30px 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  background: var(--panel);
}

.desk {
  flex: 999 1 560px;
  min-width: 0;
  padding: 30px 40px 40px;
  background: var(--desk);
  outline: 2px dashed transparent;
  outline-offset: -14px;
  transition: outline-color .15s;
}
/* While a file is dragged over the window */
.desk.drop-target { outline-color: var(--text-muted); }

/* ---------- Panel: header and purpose ---------- */

.panel-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.app-name { font-size: 15px; font-weight: 500; margin: 0; }

.purpose {
  margin-top: 14px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* ---------- Panel: sections with a left label column ---------- */

.section {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 16px;
}
.section-label { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 1.45; }
.section-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.settings-body { gap: 11px; }

.muted { color: var(--text-muted); }
#file-name { overflow-wrap: anywhere; }
.small { font-size: 13px; }
.meta { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Secondary actions are plain text links (buttons styled as links) */
.link {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover { color: var(--text-muted); }
.link-row { display: flex; gap: 16px; }

/* Workbook messages: amber words, no boxes */
.notes { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notes li { font-size: 13px; line-height: 1.45; color: var(--check); }

/* ---------- Student list ---------- */

.students { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.student { display: flex; gap: 10px; align-items: flex-start; }
.student-text { min-width: 0; }
.student-name {
  display: block;
  font-size: 14px;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.student-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.student-meta { display: block; font-size: 12.5px; color: var(--text-muted); }
.student-meta .to-check { color: var(--check); }

/* ---------- Form controls ---------- */

/* Date needs the room; the evidence count is a short number */
.fields { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
.field-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.field-label.full { grid-column: 1 / -1; }

.field {
  appearance: none;
  width: 100%;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  background: var(--field);
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color-scheme: dark;
}
textarea.field { resize: vertical; min-height: 110px; line-height: 1.45; }
select.field {
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.check-label { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check {
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  border: 1.5px solid var(--check-mark);
  border-radius: 4px;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.check:checked { background: var(--text); border-color: var(--text); }
.check:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--text-on-light);
  border-bottom: 2px solid var(--text-on-light);
  transform: translateY(-1px) rotate(-45deg);
}

/* "Edit header wording" disclosure, styled as a text link */
.wording summary {
  list-style: none;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.wording summary::-webkit-details-marker { display: none; }
.wording[open] summary { margin-bottom: 12px; }
.wording .fields { grid-template-columns: 1fr; }

/* ---------- Panel footer: main action and signature ---------- */

.panel-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 48px;  /* the colophon sits well apart from the main action */
}
.footer-body { grid-column: 2; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.button-primary {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-on-light);
  background: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 44px;
  cursor: pointer;
}
.button-primary:disabled { opacity: .4; cursor: not-allowed; }

/* Colophon: version and who to ask, with a small one-colour seal. A contact, not a credit. */
.colophon {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.colophon img { width: 20px; height: auto; display: block; flex: none; }

/* ---------- Desk: previews ---------- */

.desk-heading { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }

/* --zoom is set by app.js so a full A4 page fits the available width */
#pages { --zoom: 1; display: flex; flex-wrap: wrap; gap: 40px; }

.page-wrap { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.page-wrap figcaption { font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(210mm * var(--zoom)); }
.page-wrap .position { color: var(--text-muted); }
.page-wrap .fit-note { color: var(--check); }
.page-wrap.excluded .sheet { opacity: .3; }
.page-wrap.excluded figcaption::after { content: "Not in the PDF"; color: var(--text-muted); }

.empty { font-size: 13px; color: var(--text-muted); }

/* ---------- Narrow screens: panel above the previews ---------- */

@media (max-width: 860px) {
  .panel { flex: 1 1 100%; height: auto; position: static; overflow: visible; }
  .desk { padding: 24px 20px 32px; }
}
