/* Visor Classroom — the assignment form's two columns and its live preview
   (assignments.js: openAssignmentForm, afPreview), and the review's Sources
   card (review.js: rvSourcesCardHtml). Loaded after portal.css.

   The preview is a picture, not a page: nothing in it can be clicked or
   focused. Changes move or fade gently; nothing flashes. */

/* ---------- the form: the fields on the left, the preview on the right ---------- */
.modal.wider { max-width: 1180px; }
.af-layout { display: grid; grid-template-columns: minmax(0, 1fr) 468px; gap: 28px; align-items: start; }
.af-form { min-width: 0; }
.af-preview { position: sticky; top: 12px; min-width: 0; max-height: calc(90vh - 36px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 2px 2px; }
.af-jump { display: none; }

/* Narrow screens: the preview goes under the form, and a button at the top jumps to it */
@media (max-width: 979px) {
  .af-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .af-preview { position: static; max-height: none; overflow: visible; padding: 18px 0 0; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
  .af-jump { display: flex; margin: -4px 0 6px auto; }
  .af-jump svg { width: 15px; height: 15px; }
}

.afp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
.afp-head-note { font-size: 12px; color: var(--ink-3); }
.afp-frame, .afp-card { pointer-events: none; user-select: none; -webkit-user-select: none; }

/* ---------- writing: a small copy of Visor's editor ---------- */
.afp-frame { --afp-canvas: #F9FBFD; border: 1px solid var(--line); border-radius: 8px; background: var(--afp-canvas); overflow: hidden; box-shadow: var(--shadow-sm); }
.afp-top { background: #fff; border-bottom: 1px solid var(--line); padding: 8px 10px 0; }
.afp-bar { display: flex; align-items: center; gap: 5px; padding-bottom: 5px; }
.afp-title { flex: 1; min-width: 0; line-height: 1.25; }
.afp-h { font-weight: 700; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.afp-cls { font-size: 10.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.afp-chip { flex: none; padding: 2px 7px; border-radius: 999px; background: #EEF3F5; color: var(--ink-2); font-size: 10.5px; font-weight: 600; line-height: 1.4; white-space: nowrap; transition: background-color .25s ease, color .25s ease; }
.afp-chip.is-locked { background: var(--brand-soft); color: var(--brand); }
.afp-submit { flex: none; margin-left: 2px; padding: 3px 10px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 1.3; }
.afp-menu { display: flex; gap: 2px; margin-left: -4px; padding-bottom: 4px; font-size: 10.5px; color: var(--ink); }
.afp-menu span { padding: 0 4px; }

/* the toolbar: a pill like Docs', with the document's font and size */
.afp-tools { padding: 6px 8px 0; }
.afp-tb { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; background: #EDF2FA; color: #33494F; font-size: 10px; line-height: 1; white-space: nowrap; overflow: hidden; }
.afp-tb > i { flex: none; width: 1px; height: 11px; background: #C5CFD8; }
.afp-tb b, .afp-tb em, .afp-tb u { font-size: 10.5px; font-family: Georgia, serif; }
.afp-font { display: inline-block; width: 74px; overflow: hidden; text-overflow: ellipsis; }
.afp-lines { display: inline-flex; flex-direction: column; gap: 2px; }
.afp-lines s { display: block; width: 9px; height: 1.5px; border-radius: 1px; background: currentColor; text-decoration: none; }
.afp-lines s:nth-child(2) { width: 6px; }
.afp-cite { margin-left: auto; padding: 3px 8px; border-radius: 9px; background: #fff; box-shadow: inset 0 0 0 1px #C5CFD8; font-weight: 600; color: var(--ink); transition: opacity .25s ease; }
.afp-frame[data-wc="off"] .afp-cite { opacity: 0; }

/* the canvas: the instructions, the settings line, then the pages */
.afp-canvas { padding: 8px 10px 12px; }
.afp-instr { background: #fff; border-radius: 6px; box-shadow: var(--shadow-sm); padding: 7px 10px 8px; }
.afp-instr-h { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--ink); }
.afp-instr-h::before { content: ""; border: 3.5px solid transparent; border-top: 4.5px solid var(--ink-2); border-bottom: 0; margin-top: 1px; }
.afp-instr-b { margin-top: 3px; max-height: 76px; overflow: hidden; font-size: 11px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.afp-instr-b.is-long { -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent); }
.afp-instr-b.is-empty, .afp-card-instr.is-empty { color: var(--ink-3); font-style: italic; }
.afp-describe { margin: 7px 2px 10px; font-size: 10.5px; line-height: 1.45; color: var(--ink-2); }

/* The letter page: drawn full size in the document style (doc-format.css),
   then scaled by --afp-s (afFitPage) and cut off part way down */
.afp-pages { --afp-s: .5; display: flex; justify-content: center; align-items: stretch; }
.afp-col { flex: none; }
.afp-sheet { position: relative; width: calc(8.5in * var(--afp-s)); height: calc(4.5in * var(--afp-s)); overflow: hidden; background: #fff; box-shadow: 0 1px 3px 1px rgba(60,64,67,.13), 0 1px 2px rgba(60,64,67,.1); transition: width .3s ease, height .3s ease, margin .3s ease, opacity .3s ease, box-shadow .3s ease; }
.afp-sheet-essay::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: linear-gradient(rgba(255,255,255,0), #fff); }
.afp-paper { box-sizing: border-box; width: 8.5in; padding: 1in; color: #000; transform: scale(var(--afp-s)); transform-origin: 0 0; transition: transform .3s ease; }
.afp-paper .ql-editor { padding: 0; height: auto; min-height: 0; overflow: visible; color: #000; }
.afp-paper .ql-editor.is-empty { color: #9AA0A6; }

/* a small second page: Works Cited (or References, Bibliography) */
.afp-sheet-wc { height: calc(2.2in * var(--afp-s)); margin-top: 8px; }
.afp-frame:not([data-wc="page"]) .afp-sheet-wc { height: 0; margin-top: 0; opacity: 0; box-shadow: none; }
.afp-paper .afp-wc-h { text-align: center; }
.afp-paper .afp-wc-line { height: .5em; margin: .75em 0; border-radius: 3px; background: #E3E8EC; }
.afp-paper.doc-style-docs .afp-wc-line { margin: .33em 0; }
.afp-paper .afp-wc-hang { margin-left: .5in; width: 55%; }
.afp-paper .afp-wc-short { width: 80%; }

/* a slim Sources panel beside the page */
.afp-side { flex: none; width: 0; margin-left: 0; opacity: 0; overflow: hidden; transition: width .3s ease, margin .3s ease, opacity .3s ease; }
.afp-frame[data-wc="panel"] .afp-side { width: 118px; margin-left: 10px; opacity: 1; }
.afp-side-in { box-sizing: border-box; width: 118px; height: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.afp-side-h { font-size: 11px; font-weight: 700; color: var(--ink); }
.afp-src { margin-top: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; }
.afp-src i { display: block; height: 4px; margin: 3px 0; border-radius: 2px; background: #DDE4E9; }
.afp-src i + i { width: 60%; }
.afp-side-add { margin-top: 7px; font-size: 10px; font-weight: 600; color: var(--brand); }

/* notes under the editor */
.afp-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.afp-note { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.afp-note[hidden] { display: none; }
.afp-in { animation: afp-in .25s ease; }
@keyframes afp-in { from { opacity: 0; transform: translateY(2px); } }

/* ---------- group project and discussion: the assignment as a student opens it ---------- */
.afp-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.afp-card-top { display: flex; align-items: flex-start; gap: 11px; }
.afp-card-title { min-width: 0; flex: 1; }
.afp-card-h { font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.afp-card-meta { display: flex; flex-wrap: wrap; margin-top: 3px; font-size: 12.5px; color: var(--ink-2); }
.afp-card-meta > span:not(:last-child)::after { content: "·"; margin: 0 7px; color: var(--ink-3); }
.afp-card-date { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.afp-card-date svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.afp-card-instr { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); max-height: 360px; overflow: hidden; font-size: 13.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.afp-card-foot { margin-top: 12px; font-size: 12px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .afp-sheet, .afp-paper, .afp-side, .afp-chip, .afp-cite { transition: none; }
  .afp-in { animation: none; }
}

/* ---------- review: the Sources card (no Works Cited page) ---------- */
.rv-sources-card { max-width: 8.5in; margin: 20px auto 0; }
.rv-sources-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.rv-sources-h h3 { margin: 0; font-size: 15px; }
.rv-sources-card .rv-bib li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.rv-sources-card .rv-bib li:first-child { border-top: 0; }
.rv-sources-card .rv-bib-text { padding-left: 1.5em; text-indent: -1.5em; }
.rv-sources-card .rv-check, .rv-sources-card .rv-grade { margin-left: 1.5em; }
.rv-sources-card .rv-grade + .rv-check { margin-left: 0; }

/* ---------- the assignment page: Session settings, edited in place ----------
   (assignments.js: asCardHtml, asSync, asWire). Label and hint on the left,
   the control on the right; the site lists and starter text open underneath. */
.as-card { margin-top: 20px; padding: 6px 0 4px; overflow: hidden; }
.as-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px 4px; }
.as-top .section-title { font-size: 16px; margin: 0; }
.as-saves { font-size: 12.5px; color: var(--ink-3); }
.as-note { margin: 6px 18px 2px; padding: 8px 12px; border-radius: 8px; background: var(--amber-soft); color: #8A5A10; font-size: 13px; }
.as-sec { padding: 18px 18px 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.as-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 6px 20px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); transition: opacity .2s; }
.as-sec + .as-row { border-top: 0; }
.as-row.dim { opacity: 1; }
.as-row.dim .as-c > :not(.as-status) { opacity: .5; }
.as-l { font-weight: 600; font-size: 14px; }
.as-h { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }
.as-c { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.as-c select.input { max-width: 330px; flex: 1 1 220px; }
.as-num, .as-pair { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.as-num input { width: 92px; }
.as-pair input[type="number"] { width: 84px; }
.as-win { display: grid; grid-template-columns: auto minmax(0, 210px); gap: 6px 10px; align-items: center; font-size: 13px; color: var(--ink-2); }
.as-sum { font-size: 13.5px; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.as-edit { font-size: 13px; }
.as-seg button[aria-checked="true"] { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(14,106,136,0.25); }
.as-card .switch { cursor: pointer; }
.as-card .switch:disabled { cursor: not-allowed; opacity: .55; }
.as-card .switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* How a save went, after the control */
.as-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; min-height: 18px; color: var(--ink-3); transition: opacity .3s; }
.as-status:empty { display: none; }
.as-status.saved { color: var(--green-deep); font-weight: 600; animation: asIn .2s var(--ease, ease); }
.as-status.saved svg { width: 14px; height: 14px; }
.as-status.error { color: var(--red, #B42318); font-weight: 600; flex-basis: 100%; }
@keyframes asIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
/* The box under a row: opens smoothly (grid rows 0fr -> 1fr) */
.as-more { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease, ease); }
.as-more.open { grid-template-rows: 1fr; }
.as-more-in { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s .3s; }
.as-more.open .as-more-in { visibility: visible; transition: visibility 0s; }
.as-more-pad { padding: 8px 0 4px; }
.as-more textarea { min-height: 110px; }
.as-more-acts { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.as-more-acts .linklike { margin-left: auto; font-size: 13px; }
@media (max-width: 720px) {
  .as-row { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
  .as-top, .as-sec { padding-left: 14px; padding-right: 14px; }
  .as-note { margin-left: 14px; margin-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .as-more, .as-more-in, .as-status { transition: none; animation: none; }
}
